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.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 2868a1bc3..cc7d38d7c 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -57,7 +57,9 @@ static int doForce = FALSE;
57#if defined BB_FEATURE_MOUNT_LOOP 57#if defined BB_FEATURE_MOUNT_LOOP
58static int freeLoop = TRUE; 58static int freeLoop = TRUE;
59#endif 59#endif
60#if defined BB_MTAB
60static int useMtab = TRUE; 61static int useMtab = TRUE;
62#endif
61static int umountAll = FALSE; 63static int umountAll = FALSE;
62static int doRemount = FALSE; 64static int doRemount = FALSE;
63extern const char mtab_file[]; /* Defined in utility.c */ 65extern const char mtab_file[]; /* Defined in utility.c */
@@ -162,7 +164,7 @@ void mtab_free(void)
162} 164}
163#endif 165#endif
164 166
165static int do_umount(const char *name, int useMtab) 167static int do_umount(const char *name)
166{ 168{
167 int status; 169 int status;
168 char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE); 170 char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE);
@@ -204,7 +206,7 @@ static int do_umount(const char *name, int useMtab)
204 return (FALSE); 206 return (FALSE);
205} 207}
206 208
207static int umount_all(int useMtab) 209static int umount_all(void)
208{ 210{
209 int status = TRUE; 211 int status = TRUE;
210 char *mountpt; 212 char *mountpt;
@@ -214,14 +216,14 @@ static int umount_all(int useMtab)
214 /* Never umount /proc on a umount -a */ 216 /* Never umount /proc on a umount -a */
215 if (strstr(mountpt, "proc")!= NULL) 217 if (strstr(mountpt, "proc")!= NULL)
216 continue; 218 continue;
217 if (!do_umount(mountpt, useMtab)) { 219 if (!do_umount(mountpt)) {
218 /* Don't bother retrying the umount on busy devices */ 220 /* Don't bother retrying the umount on busy devices */
219 if (errno == EBUSY) { 221 if (errno == EBUSY) {
220 perror_msg("%s", mountpt); 222 perror_msg("%s", mountpt);
221 status = FALSE; 223 status = FALSE;
222 continue; 224 continue;
223 } 225 }
224 if (!do_umount(mountpt, useMtab)) { 226 if (!do_umount(mountpt)) {
225 printf("Couldn't umount %s on %s: %s\n", 227 printf("Couldn't umount %s on %s: %s\n",
226 mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE), 228 mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE),
227 strerror(errno)); 229 strerror(errno));
@@ -275,12 +277,12 @@ extern int umount_main(int argc, char **argv)
275 277
276 mtab_read(); 278 mtab_read();
277 if (umountAll == TRUE) { 279 if (umountAll == TRUE) {
278 if (umount_all(useMtab) == TRUE) 280 if (umount_all() == TRUE)
279 return EXIT_SUCCESS; 281 return EXIT_SUCCESS;
280 else 282 else
281 return EXIT_FAILURE; 283 return EXIT_FAILURE;
282 } 284 }
283 if (do_umount(*argv, useMtab) == TRUE) 285 if (do_umount(*argv) == TRUE)
284 return EXIT_SUCCESS; 286 return EXIT_SUCCESS;
285 perror_msg_and_die("%s", *argv); 287 perror_msg_and_die("%s", *argv);
286} 288}