summaryrefslogtreecommitdiff
path: root/util-linux/umount.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-03-13 04:07:02 +0000
committerErik Andersen <andersen@codepoet.org>2000-03-13 04:07:02 +0000
commitce91732416d3fb68ebf527ec839e8f810ea65ebd (patch)
tree23f70e6e90faa8e7f8aac7d336fe88bbf646efeb /util-linux/umount.c
parent3522eb1ab3a4f1bcbf2c0f0eed387733b29c9e95 (diff)
downloadbusybox-ce91732416d3fb68ebf527ec839e8f810ea65ebd.tar.gz
Some bug fixes I forgot to check-in the other day.
Mounting loop devices w/o specifying the filesystem type choked if it didn't guess right the first time. -Erik
Diffstat (limited to 'util-linux/umount.c')
-rw-r--r--util-linux/umount.c15
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[] =
#ifdef BB_FEATURE_REMOUNT
"\t-r:\tTry to remount devices as read-only if mount is busy\n"
#endif
+#if defined BB_FEATURE_MOUNT_LOOP
+ "\t-f:\tDo not free loop device (if a loop device has been used)\n"
+#endif
;
struct _mtab_entry_t {
@@ -53,9 +56,14 @@ static struct _mtab_entry_t *mtab_cache = NULL;
+#if defined BB_FEATURE_MOUNT_LOOP
+static int freeLoop = TRUE;
+#endif
static int useMtab = TRUE;
static int umountAll = FALSE;
+#if defined BB_FEATURE_REMOUNT
static int doRemount = FALSE;
+#endif
extern const char mtab_file[]; /* Defined in utility.c */
@@ -167,7 +175,7 @@ static int do_umount(const char *name, int useMtab)
status = umount(name);
#if defined BB_FEATURE_MOUNT_LOOP
- if (blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
+ if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
/* this was a loop device, delete it */
del_loop(blockDevice);
#endif
@@ -236,6 +244,11 @@ extern int umount_main(int argc, char **argv)
case 'a':
umountAll = TRUE;
break;
+#if defined BB_FEATURE_MOUNT_LOOP
+ case 'f':
+ freeLoop = FALSE;
+ break;
+#endif
#ifdef BB_MTAB
case 'n':
useMtab = FALSE;