diff options
-rw-r--r-- | util-linux/umount.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c index 9c551f986..6ba72aed1 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -54,11 +54,12 @@ int umount_main(int argc, char **argv) | |||
54 | /* If we're umounting all, then m points to the start of the list and | 54 | /* If we're umounting all, then m points to the start of the list and |
55 | * the argument list should be empty (which will match all). */ | 55 | * the argument list should be empty (which will match all). */ |
56 | 56 | ||
57 | if (!(fp = setmntent(bb_path_mtab_file, "r"))) { | 57 | fp = setmntent(bb_path_mtab_file, "r"); |
58 | if (!fp) { | ||
58 | if (opt & OPT_ALL) | 59 | if (opt & OPT_ALL) |
59 | bb_error_msg_and_die("cannot open %s", bb_path_mtab_file); | 60 | bb_error_msg_and_die("cannot open %s", bb_path_mtab_file); |
60 | } else { | 61 | } else { |
61 | while (getmntent_r(fp,&me,path,sizeof(path))) { | 62 | while (getmntent_r(fp, &me, path, sizeof(path))) { |
62 | m = xmalloc(sizeof(struct mtab_list)); | 63 | m = xmalloc(sizeof(struct mtab_list)); |
63 | m->next = mtl; | 64 | m->next = mtl; |
64 | m->device = xstrdup(me.mnt_fsname); | 65 | m->device = xstrdup(me.mnt_fsname); |
@@ -68,7 +69,7 @@ int umount_main(int argc, char **argv) | |||
68 | endmntent(fp); | 69 | endmntent(fp); |
69 | } | 70 | } |
70 | 71 | ||
71 | /* If we're not mounting all, we need at least one argument. */ | 72 | /* If we're not umounting all, we need at least one argument. */ |
72 | if (!(opt & OPT_ALL)) { | 73 | if (!(opt & OPT_ALL)) { |
73 | m = 0; | 74 | m = 0; |
74 | if (!argc) bb_show_usage(); | 75 | if (!argc) bb_show_usage(); |
@@ -104,7 +105,7 @@ int umount_main(int argc, char **argv) | |||
104 | if (curstat && doForce) { | 105 | if (curstat && doForce) { |
105 | curstat = umount2(zapit, doForce); | 106 | curstat = umount2(zapit, doForce); |
106 | if (curstat) | 107 | if (curstat) |
107 | bb_error_msg_and_die("forced umount of %s failed!", zapit); | 108 | bb_error_msg("forced umount of %s failed!", zapit); |
108 | } | 109 | } |
109 | 110 | ||
110 | // If still can't umount, maybe remount read-only? | 111 | // If still can't umount, maybe remount read-only? |
@@ -130,7 +131,7 @@ int umount_main(int argc, char **argv) | |||
130 | // Note this means that "umount /dev/blah" will unmount all instances | 131 | // Note this means that "umount /dev/blah" will unmount all instances |
131 | // of /dev/blah, not just the most recent. | 132 | // of /dev/blah, not just the most recent. |
132 | while (m && (m = m->next)) | 133 | while (m && (m = m->next)) |
133 | if ((opt & OPT_ALL) || !strcmp(path,m->device)) | 134 | if ((opt & OPT_ALL) || !strcmp(path, m->device)) |
134 | break; | 135 | break; |
135 | } | 136 | } |
136 | 137 | ||