aboutsummaryrefslogtreecommitdiff
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
parent3522eb1ab3a4f1bcbf2c0f0eed387733b29c9e95 (diff)
downloadbusybox-w32-ce91732416d3fb68ebf527ec839e8f810ea65ebd.tar.gz
busybox-w32-ce91732416d3fb68ebf527ec839e8f810ea65ebd.tar.bz2
busybox-w32-ce91732416d3fb68ebf527ec839e8f810ea65ebd.zip
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
-rw-r--r--Changelog2
-rw-r--r--mount.c3
-rw-r--r--umount.c15
-rw-r--r--util-linux/mount.c3
-rw-r--r--util-linux/umount.c15
5 files changed, 32 insertions, 6 deletions
diff --git a/Changelog b/Changelog
index 5678f60c2..c6493f8a3 100644
--- a/Changelog
+++ b/Changelog
@@ -45,6 +45,8 @@
45 * Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a "-e") 45 * Fixed a bug where "sed 's/foo/bar/g'" (i.e. a script w/o a "-e")
46 * ps now supports BB_FEATURE_AUTOWIDTH, and can adjust its width 46 * ps now supports BB_FEATURE_AUTOWIDTH, and can adjust its width
47 to match the terminal (defaults to width=79 when this is off). 47 to match the terminal (defaults to width=79 when this is off).
48 * Fixed mount'ing loop devices when the filesystem type was not
49 specified. It used to revert to non-loop after the first try.
48 50
49 51
50 -Erik Andersen 52 -Erik Andersen
diff --git a/mount.c b/mount.c
index c29be5106..336cff7d2 100644
--- a/mount.c
+++ b/mount.c
@@ -142,7 +142,6 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
142 fprintf(stderr, "WARNING: loop device is read-only\n"); 142 fprintf(stderr, "WARNING: loop device is read-only\n");
143 flags &= ~MS_RDONLY; 143 flags &= ~MS_RDONLY;
144 } 144 }
145 use_loop = FALSE;
146 } 145 }
147#endif 146#endif
148 status = 147 status =
@@ -415,10 +414,10 @@ extern int mount_main(int argc, char **argv)
415 case 'a': 414 case 'a':
416 all = TRUE; 415 all = TRUE;
417 break; 416 break;
418#ifdef BB_MTAB
419 case 'f': 417 case 'f':
420 fakeIt = TRUE; 418 fakeIt = TRUE;
421 break; 419 break;
420#ifdef BB_MTAB
422 case 'n': 421 case 'n':
423 useMtab = FALSE; 422 useMtab = FALSE;
424 break; 423 break;
diff --git a/umount.c b/umount.c
index 0f087e197..b0f393cca 100644
--- a/umount.c
+++ b/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
46struct _mtab_entry_t { 49struct _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
60static int freeLoop = TRUE;
61#endif
56static int useMtab = TRUE; 62static int useMtab = TRUE;
57static int umountAll = FALSE; 63static int umountAll = FALSE;
64#if defined BB_FEATURE_REMOUNT
58static int doRemount = FALSE; 65static int doRemount = FALSE;
66#endif
59extern const char mtab_file[]; /* Defined in utility.c */ 67extern 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;
diff --git a/util-linux/mount.c b/util-linux/mount.c
index c29be5106..336cff7d2 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -142,7 +142,6 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
142 fprintf(stderr, "WARNING: loop device is read-only\n"); 142 fprintf(stderr, "WARNING: loop device is read-only\n");
143 flags &= ~MS_RDONLY; 143 flags &= ~MS_RDONLY;
144 } 144 }
145 use_loop = FALSE;
146 } 145 }
147#endif 146#endif
148 status = 147 status =
@@ -415,10 +414,10 @@ extern int mount_main(int argc, char **argv)
415 case 'a': 414 case 'a':
416 all = TRUE; 415 all = TRUE;
417 break; 416 break;
418#ifdef BB_MTAB
419 case 'f': 417 case 'f':
420 fakeIt = TRUE; 418 fakeIt = TRUE;
421 break; 419 break;
420#ifdef BB_MTAB
422 case 'n': 421 case 'n':
423 useMtab = FALSE; 422 useMtab = FALSE;
424 break; 423 break;
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
46struct _mtab_entry_t { 49struct _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
60static int freeLoop = TRUE;
61#endif
56static int useMtab = TRUE; 62static int useMtab = TRUE;
57static int umountAll = FALSE; 63static int umountAll = FALSE;
64#if defined BB_FEATURE_REMOUNT
58static int doRemount = FALSE; 65static int doRemount = FALSE;
66#endif
59extern const char mtab_file[]; /* Defined in utility.c */ 67extern 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;