diff options
Diffstat (limited to 'util-linux/umount.c')
-rw-r--r-- | util-linux/umount.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/util-linux/umount.c b/util-linux/umount.c index 0f087e197..b0f393cca 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -41,6 +41,9 @@ static const char umount_usage[] = | |||
41 | #ifdef BB_FEATURE_REMOUNT | 41 | #ifdef BB_FEATURE_REMOUNT |
42 | "\t-r:\tTry to remount devices as read-only if mount is busy\n" | 42 | "\t-r:\tTry to remount devices as read-only if mount is busy\n" |
43 | #endif | 43 | #endif |
44 | #if defined BB_FEATURE_MOUNT_LOOP | ||
45 | "\t-f:\tDo not free loop device (if a loop device has been used)\n" | ||
46 | #endif | ||
44 | ; | 47 | ; |
45 | 48 | ||
46 | struct _mtab_entry_t { | 49 | struct _mtab_entry_t { |
@@ -53,9 +56,14 @@ static struct _mtab_entry_t *mtab_cache = NULL; | |||
53 | 56 | ||
54 | 57 | ||
55 | 58 | ||
59 | #if defined BB_FEATURE_MOUNT_LOOP | ||
60 | static int freeLoop = TRUE; | ||
61 | #endif | ||
56 | static int useMtab = TRUE; | 62 | static int useMtab = TRUE; |
57 | static int umountAll = FALSE; | 63 | static int umountAll = FALSE; |
64 | #if defined BB_FEATURE_REMOUNT | ||
58 | static int doRemount = FALSE; | 65 | static int doRemount = FALSE; |
66 | #endif | ||
59 | extern const char mtab_file[]; /* Defined in utility.c */ | 67 | extern const char mtab_file[]; /* Defined in utility.c */ |
60 | 68 | ||
61 | 69 | ||
@@ -167,7 +175,7 @@ static int do_umount(const char *name, int useMtab) | |||
167 | status = umount(name); | 175 | status = umount(name); |
168 | 176 | ||
169 | #if defined BB_FEATURE_MOUNT_LOOP | 177 | #if defined BB_FEATURE_MOUNT_LOOP |
170 | if (blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) | 178 | if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9)) |
171 | /* this was a loop device, delete it */ | 179 | /* this was a loop device, delete it */ |
172 | del_loop(blockDevice); | 180 | del_loop(blockDevice); |
173 | #endif | 181 | #endif |
@@ -236,6 +244,11 @@ extern int umount_main(int argc, char **argv) | |||
236 | case 'a': | 244 | case 'a': |
237 | umountAll = TRUE; | 245 | umountAll = TRUE; |
238 | break; | 246 | break; |
247 | #if defined BB_FEATURE_MOUNT_LOOP | ||
248 | case 'f': | ||
249 | freeLoop = FALSE; | ||
250 | break; | ||
251 | #endif | ||
239 | #ifdef BB_MTAB | 252 | #ifdef BB_MTAB |
240 | case 'n': | 253 | case 'n': |
241 | useMtab = FALSE; | 254 | useMtab = FALSE; |