]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Correctly handle -f (fake) mount option.
authorKarel Zak <kzak@redhat.com>
Mon, 19 Mar 2007 19:33:17 +0000 (20:33 +0100)
committerNeil Brown <neilb@suse.de>
Mon, 19 Mar 2007 22:31:33 +0000 (09:31 +1100)
The fake option has to write to mtab like a normal mount. Read mount(8) man
page for more details.  It's very important for system init scripts that use
"-f" as a way how write info about mount points to /etc/mtab.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/mount/mount.c

index 45428b0c0662cc60400b5935d8d7cb0c1604bdb5..55d60aa63b8298032d44dfdd0b89c949976a5d7d 100644 (file)
@@ -443,18 +443,18 @@ int main(int argc, char *argv[])
                        start_statd();
        }
 
-       if (fake)
-               return 0;
        if (mnt_err)
                exit(EX_FAIL);
 
-       mnt_err = do_mount_syscall(spec, mount_point,
-                                  nfs_mount_vers == 4 ? "nfs4" : "nfs",
-                                  flags, mount_opts);
-               
-       if (mnt_err) {
-               mount_error(mount_point);
-               exit(EX_FAIL);
+       if (!fake) {
+               mnt_err = do_mount_syscall(spec, mount_point,
+                                          nfs_mount_vers == 4 ? "nfs4" : "nfs",
+                                          flags, mount_opts);
+
+               if (mnt_err) {
+                       mount_error(mount_point);
+                       exit(EX_FAIL);
+               }
        }
 
        if (!nomtab)