aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-29 14:43:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-29 14:43:20 +0000
commitb1726785f947c35c11d2148196b8fa8b30445798 (patch)
treee8005c72da8f6c1ce92af3cd8474a4cf213dd942
parentf0d6cc8ca97454e64c041c571320d2288d1f2cd9 (diff)
downloadbusybox-w32-b1726785f947c35c11d2148196b8fa8b30445798.tar.gz
busybox-w32-b1726785f947c35c11d2148196b8fa8b30445798.tar.bz2
busybox-w32-b1726785f947c35c11d2148196b8fa8b30445798.zip
mount: fix bug 946 (mount -f should update mtab)
-rw-r--r--util-linux/mount.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 3daab2831..9b93986c2 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -224,9 +224,9 @@ static int fakeIt;
224// NB: mp->xxx fields may be trashed on exit 224// NB: mp->xxx fields may be trashed on exit
225static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts) 225static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
226{ 226{
227 int rc; 227 int rc = 0;
228 228
229 if (fakeIt) return 0; 229 if (fakeIt) goto mtab;
230 230
231 // Mount, with fallback to read-only if necessary. 231 // Mount, with fallback to read-only if necessary.
232 232
@@ -247,7 +247,7 @@ static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
247 247
248 /* If the mount was successful, and we're maintaining an old-style 248 /* If the mount was successful, and we're maintaining an old-style
249 * mtab file by hand, add the new entry to it now. */ 249 * mtab file by hand, add the new entry to it now. */
250 250mtab:
251 if (ENABLE_FEATURE_MTAB_SUPPORT && useMtab && !rc && !(vfsflags & MS_REMOUNT)) { 251 if (ENABLE_FEATURE_MTAB_SUPPORT && useMtab && !rc && !(vfsflags & MS_REMOUNT)) {
252 char *fsname; 252 char *fsname;
253 FILE *mountTable = setmntent(bb_path_mtab_file, "a+"); 253 FILE *mountTable = setmntent(bb_path_mtab_file, "a+");
@@ -1452,8 +1452,8 @@ int mount_main(int argc, char **argv)
1452 if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r 1452 if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r
1453 if (opt & 0x8) append_mount_options(&cmdopts, "rw"); // -w 1453 if (opt & 0x8) append_mount_options(&cmdopts, "rw"); // -w
1454 //if (opt & 0x10) // -a 1454 //if (opt & 0x10) // -a
1455 if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = FALSE); // -n 1455 if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = 0); // -n
1456 if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = FALSE); // -f 1456 if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = 1); // -f
1457 //if (opt & 0x80) // -v: ignore 1457 //if (opt & 0x80) // -v: ignore
1458 argv += optind; 1458 argv += optind;
1459 argc -= optind; 1459 argc -= optind;
@@ -1513,7 +1513,7 @@ int mount_main(int argc, char **argv)
1513 1513
1514 if (parse_mount_options(cmdopts,0) & MS_REMOUNT) 1514 if (parse_mount_options(cmdopts,0) & MS_REMOUNT)
1515 fstabname = bb_path_mtab_file; 1515 fstabname = bb_path_mtab_file;
1516 else fstabname="/etc/fstab"; 1516 else fstabname = "/etc/fstab";
1517 1517
1518 fstab = setmntent(fstabname,"r"); 1518 fstab = setmntent(fstabname,"r");
1519 if (!fstab) 1519 if (!fstab)