aboutsummaryrefslogtreecommitdiff
path: root/util-linux/umount.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/umount.c')
-rw-r--r--util-linux/umount.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 391d245a8..1d3e89301 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -67,7 +67,6 @@ static int useMtab = TRUE;
67#endif 67#endif
68static int umountAll = FALSE; 68static int umountAll = FALSE;
69static int doRemount = FALSE; 69static int doRemount = FALSE;
70extern const char mtab_file[]; /* Defined in utility.c */
71 70
72 71
73 72
@@ -87,8 +86,8 @@ static void mtab_read(void)
87 if (mtab_cache != NULL) 86 if (mtab_cache != NULL)
88 return; 87 return;
89 88
90 if ((fp = setmntent(mtab_file, "r")) == NULL) { 89 if ((fp = setmntent(bb_path_mtab_file, "r")) == NULL) {
91 error_msg("Cannot open %s", mtab_file); 90 bb_error_msg("Cannot open %s", bb_path_mtab_file);
92 return; 91 return;
93 } 92 }
94 while ((e = getmntent(fp))) { 93 while ((e = getmntent(fp))) {
@@ -185,7 +184,7 @@ static int do_umount(const char *name)
185 if (status != 0 && doForce) { 184 if (status != 0 && doForce) {
186 status = umount2(blockDevice, MNT_FORCE); 185 status = umount2(blockDevice, MNT_FORCE);
187 if (status != 0) { 186 if (status != 0) {
188 error_msg_and_die("forced umount of %s failed!", blockDevice); 187 bb_error_msg_and_die("forced umount of %s failed!", blockDevice);
189 } 188 }
190 } 189 }
191#endif 190#endif
@@ -193,9 +192,9 @@ static int do_umount(const char *name)
193 status = mount(blockDevice, name, NULL, 192 status = mount(blockDevice, name, NULL,
194 MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); 193 MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
195 if (status == 0) { 194 if (status == 0) {
196 error_msg("%s busy - remounted read-only", blockDevice); 195 bb_error_msg("%s busy - remounted read-only", blockDevice);
197 } else { 196 } else {
198 error_msg("Cannot remount %s read-only", blockDevice); 197 bb_error_msg("Cannot remount %s read-only", blockDevice);
199 } 198 }
200 } 199 }
201 if (status == 0) { 200 if (status == 0) {
@@ -221,7 +220,7 @@ static int umount_all(void)
221 if (!do_umount(mountpt)) { 220 if (!do_umount(mountpt)) {
222 /* Don't bother retrying the umount on busy devices */ 221 /* Don't bother retrying the umount on busy devices */
223 if (errno == EBUSY) { 222 if (errno == EBUSY) {
224 perror_msg("%s", mountpt); 223 bb_perror_msg("%s", mountpt);
225 status = FALSE; 224 status = FALSE;
226 continue; 225 continue;
227 } 226 }
@@ -241,7 +240,7 @@ extern int umount_main(int argc, char **argv)
241 char path[PATH_MAX]; 240 char path[PATH_MAX];
242 241
243 if (argc < 2) { 242 if (argc < 2) {
244 show_usage(); 243 bb_show_usage();
245 } 244 }
246#ifdef CONFIG_FEATURE_CLEAN_UP 245#ifdef CONFIG_FEATURE_CLEAN_UP
247 atexit(mtab_free); 246 atexit(mtab_free);
@@ -275,7 +274,7 @@ extern int umount_main(int argc, char **argv)
275 case 'v': 274 case 'v':
276 break; /* ignore -v */ 275 break; /* ignore -v */
277 default: 276 default:
278 show_usage(); 277 bb_show_usage();
279 } 278 }
280 } 279 }
281 280
@@ -287,9 +286,9 @@ extern int umount_main(int argc, char **argv)
287 return EXIT_FAILURE; 286 return EXIT_FAILURE;
288 } 287 }
289 if (realpath(*argv, path) == NULL) 288 if (realpath(*argv, path) == NULL)
290 perror_msg_and_die("%s", path); 289 bb_perror_msg_and_die("%s", path);
291 if (do_umount(path)) 290 if (do_umount(path))
292 return EXIT_SUCCESS; 291 return EXIT_SUCCESS;
293 perror_msg_and_die("%s", *argv); 292 bb_perror_msg_and_die("%s", *argv);
294} 293}
295 294