svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Fri Sep 29 14:43:20 UTC 2006


Author: vda
Date: 2006-09-29 07:43:20 -0700 (Fri, 29 Sep 2006)
New Revision: 16259

Log:
mount: fix bug 946 (mount -f should update mtab)


Modified:
   trunk/busybox/util-linux/mount.c


Changeset:
Modified: trunk/busybox/util-linux/mount.c
===================================================================
--- trunk/busybox/util-linux/mount.c	2006-09-29 13:56:58 UTC (rev 16258)
+++ trunk/busybox/util-linux/mount.c	2006-09-29 14:43:20 UTC (rev 16259)
@@ -224,9 +224,9 @@
 // NB: mp->xxx fields may be trashed on exit
 static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
 {
-	int rc;
+	int rc = 0;
 
-	if (fakeIt) return 0;
+	if (fakeIt) goto mtab;
 
 	// Mount, with fallback to read-only if necessary.
 
@@ -247,7 +247,7 @@
 
 	/* If the mount was successful, and we're maintaining an old-style
 	 * mtab file by hand, add the new entry to it now. */
-
+mtab:
 	if (ENABLE_FEATURE_MTAB_SUPPORT && useMtab && !rc && !(vfsflags & MS_REMOUNT)) {
 		char *fsname;
 		FILE *mountTable = setmntent(bb_path_mtab_file, "a+");
@@ -1452,8 +1452,8 @@
 	if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r
 	if (opt & 0x8) append_mount_options(&cmdopts, "rw"); // -w
 	//if (opt & 0x10) // -a
-	if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = FALSE); // -n
-	if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = FALSE); // -f
+	if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = 0); // -n
+	if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = 1); // -f
 	//if (opt & 0x80) // -v: ignore
 	argv += optind;
 	argc -= optind;
@@ -1513,7 +1513,7 @@
 
 	if (parse_mount_options(cmdopts,0) & MS_REMOUNT)
 		fstabname = bb_path_mtab_file;
-	else fstabname="/etc/fstab";
+	else fstabname = "/etc/fstab";
 
 	fstab = setmntent(fstabname,"r");
 	if (!fstab)




More information about the busybox-cvs mailing list