diff options
Diffstat (limited to 'libbb/mtab.c')
-rw-r--r-- | libbb/mtab.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libbb/mtab.c b/libbb/mtab.c index c521b1e05..54905c724 100644 --- a/libbb/mtab.c +++ b/libbb/mtab.c | |||
@@ -27,21 +27,20 @@ | |||
27 | #include <mntent.h> | 27 | #include <mntent.h> |
28 | #include "libbb.h" | 28 | #include "libbb.h" |
29 | 29 | ||
30 | extern const char mtab_file[]; /* Defined in utility.c */ | ||
31 | static const int MS_RDONLY = 1; /* Mount read-only. */ | 30 | static const int MS_RDONLY = 1; /* Mount read-only. */ |
32 | 31 | ||
33 | void erase_mtab(const char *name) | 32 | void erase_mtab(const char *name) |
34 | { | 33 | { |
35 | struct mntent entries[20]; | 34 | struct mntent entries[20]; |
36 | int count = 0; | 35 | int count = 0; |
37 | FILE *mountTable = setmntent(mtab_file, "r"); | 36 | FILE *mountTable = setmntent(bb_path_mtab_file, "r"); |
38 | struct mntent *m; | 37 | struct mntent *m; |
39 | 38 | ||
40 | /* Check if reading the mtab file failed */ | 39 | /* Check if reading the mtab file failed */ |
41 | if (mountTable == 0 | 40 | if (mountTable == 0 |
42 | /* Bummer. fall back on trying the /proc filesystem */ | 41 | /* Bummer. fall back on trying the /proc filesystem */ |
43 | && (mountTable = setmntent("/proc/mounts", "r")) == 0) { | 42 | && (mountTable = setmntent("/proc/mounts", "r")) == 0) { |
44 | perror_msg("%s", mtab_file); | 43 | bb_perror_msg(bb_path_mtab_file); |
45 | return; | 44 | return; |
46 | } | 45 | } |
47 | 46 | ||
@@ -55,7 +54,7 @@ void erase_mtab(const char *name) | |||
55 | count++; | 54 | count++; |
56 | } | 55 | } |
57 | endmntent(mountTable); | 56 | endmntent(mountTable); |
58 | if ((mountTable = setmntent(mtab_file, "w"))) { | 57 | if ((mountTable = setmntent(bb_path_mtab_file, "w"))) { |
59 | int i; | 58 | int i; |
60 | 59 | ||
61 | for (i = 0; i < count; i++) { | 60 | for (i = 0; i < count; i++) { |
@@ -69,17 +68,17 @@ void erase_mtab(const char *name) | |||
69 | } | 68 | } |
70 | endmntent(mountTable); | 69 | endmntent(mountTable); |
71 | } else if (errno != EROFS) | 70 | } else if (errno != EROFS) |
72 | perror_msg("%s", mtab_file); | 71 | bb_perror_msg(bb_path_mtab_file); |
73 | } | 72 | } |
74 | 73 | ||
75 | void write_mtab(char *blockDevice, char *directory, | 74 | void write_mtab(char *blockDevice, char *directory, |
76 | char *filesystemType, long flags, char *string_flags) | 75 | char *filesystemType, long flags, char *string_flags) |
77 | { | 76 | { |
78 | FILE *mountTable = setmntent(mtab_file, "a+"); | 77 | FILE *mountTable = setmntent(bb_path_mtab_file, "a+"); |
79 | struct mntent m; | 78 | struct mntent m; |
80 | 79 | ||
81 | if (mountTable == 0) { | 80 | if (mountTable == 0) { |
82 | perror_msg("%s", mtab_file); | 81 | bb_perror_msg(bb_path_mtab_file); |
83 | return; | 82 | return; |
84 | } | 83 | } |
85 | if (mountTable) { | 84 | if (mountTable) { |