aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/umount.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 16d3dfb82..c57a49ef4 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -12,13 +12,14 @@
12#include <getopt.h> 12#include <getopt.h>
13#include "libbb.h" 13#include "libbb.h"
14 14
15#define OPTION_STRING "flDnravdt:" 15/* ignored: -v -d -t -i */
16#define OPT_FORCE 1 16#define OPTION_STRING "flDnra" "vdt:i"
17#define OPT_LAZY 2 17#define OPT_FORCE (1 << 0)
18#define OPT_DONTFREELOOP 4 18#define OPT_LAZY (1 << 1)
19#define OPT_NO_MTAB 8 19#define OPT_DONTFREELOOP (1 << 2)
20#define OPT_REMOUNT 16 20#define OPT_NO_MTAB (1 << 3)
21#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? 32 : 0) 21#define OPT_REMOUNT (1 << 4)
22#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 5) : 0)
22 23
23int umount_main(int argc, char **argv); 24int umount_main(int argc, char **argv);
24int umount_main(int argc, char **argv) 25int umount_main(int argc, char **argv)
@@ -77,7 +78,8 @@ int umount_main(int argc, char **argv)
77 /* If we're not umounting all, we need at least one argument. */ 78 /* If we're not umounting all, we need at least one argument. */
78 if (!(opt & OPT_ALL) && !fstype) { 79 if (!(opt & OPT_ALL) && !fstype) {
79 m = 0; 80 m = 0;
80 if (!argc) bb_show_usage(); 81 if (!argc)
82 bb_show_usage();
81 } 83 }
82 84
83 // Loop through everything we're supposed to umount, and do so. 85 // Loop through everything we're supposed to umount, and do so.
@@ -86,11 +88,14 @@ int umount_main(int argc, char **argv)
86 char *zapit = *argv; 88 char *zapit = *argv;
87 89
88 // Do we already know what to umount this time through the loop? 90 // Do we already know what to umount this time through the loop?
89 if (m) safe_strncpy(path, m->dir, PATH_MAX); 91 if (m)
92 safe_strncpy(path, m->dir, PATH_MAX);
90 // For umount -a, end of mtab means time to exit. 93 // For umount -a, end of mtab means time to exit.
91 else if (opt & OPT_ALL) break; 94 else if (opt & OPT_ALL)
95 break;
92 // Get next command line argument (and look it up in mtab list) 96 // Get next command line argument (and look it up in mtab list)
93 else if (!argc--) break; 97 else if (!argc--)
98 break;
94 else { 99 else {
95 argv++; 100 argv++;
96 realpath(zapit, path); 101 realpath(zapit, path);