diff options
-rw-r--r-- | util-linux/umount.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c index fabc3d049..1a6b14ccc 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -59,15 +59,17 @@ int umount_main(int argc, char **argv) | |||
59 | 59 | ||
60 | if (!(fp = setmntent(bb_path_mtab_file, "r"))) { | 60 | if (!(fp = setmntent(bb_path_mtab_file, "r"))) { |
61 | if (opt & OPT_ALL) | 61 | if (opt & OPT_ALL) |
62 | bb_error_msg_and_die("Cannot open %s", bb_path_mtab_file); | 62 | bb_error_msg_and_die("cannot open %s", bb_path_mtab_file); |
63 | } else while (getmntent_r(fp,&me,path,sizeof(path))) { | 63 | } else { |
64 | m = xmalloc(sizeof(struct mtab_list)); | 64 | while (getmntent_r(fp,&me,path,sizeof(path))) { |
65 | m->next = mtl; | 65 | m = xmalloc(sizeof(struct mtab_list)); |
66 | m->device = xstrdup(me.mnt_fsname); | 66 | m->next = mtl; |
67 | m->dir = xstrdup(me.mnt_dir); | 67 | m->device = xstrdup(me.mnt_fsname); |
68 | mtl = m; | 68 | m->dir = xstrdup(me.mnt_dir); |
69 | mtl = m; | ||
70 | } | ||
71 | endmntent(fp); | ||
69 | } | 72 | } |
70 | endmntent(fp); | ||
71 | 73 | ||
72 | /* If we're not mounting all, we need at least one argument. */ | 74 | /* If we're not mounting all, we need at least one argument. */ |
73 | if (!(opt & OPT_ALL)) { | 75 | if (!(opt & OPT_ALL)) { |
@@ -111,13 +113,13 @@ int umount_main(int argc, char **argv) | |||
111 | // If still can't umount, maybe remount read-only? | 113 | // If still can't umount, maybe remount read-only? |
112 | if (curstat && (opt & OPT_REMOUNT) && errno == EBUSY && m) { | 114 | if (curstat && (opt & OPT_REMOUNT) && errno == EBUSY && m) { |
113 | curstat = mount(m->device, zapit, NULL, MS_REMOUNT|MS_RDONLY, NULL); | 115 | curstat = mount(m->device, zapit, NULL, MS_REMOUNT|MS_RDONLY, NULL); |
114 | bb_error_msg(curstat ? "Cannot remount %s read-only" : | 116 | bb_error_msg(curstat ? "cannot remount %s read-only" : |
115 | "%s busy - remounted read-only", m->device); | 117 | "%s busy - remounted read-only", m->device); |
116 | } | 118 | } |
117 | 119 | ||
118 | if (curstat) { | 120 | if (curstat) { |
119 | status = EXIT_FAILURE; | 121 | status = EXIT_FAILURE; |
120 | bb_perror_msg("Couldn't umount %s", zapit); | 122 | bb_perror_msg("cannot umount %s", zapit); |
121 | } else { | 123 | } else { |
122 | /* De-allocate the loop device. This ioctl should be ignored on | 124 | /* De-allocate the loop device. This ioctl should be ignored on |
123 | * any non-loop block devices. */ | 125 | * any non-loop block devices. */ |
@@ -143,7 +145,7 @@ int umount_main(int argc, char **argv) | |||
143 | free(mtl->device); | 145 | free(mtl->device); |
144 | free(mtl->dir); | 146 | free(mtl->dir); |
145 | free(mtl); | 147 | free(mtl); |
146 | mtl=m; | 148 | mtl = m; |
147 | } | 149 | } |
148 | } | 150 | } |
149 | 151 | ||