From: Karel Zak Date: Mon, 19 Mar 2007 19:33:17 +0000 (+0100) Subject: Correctly handle -f (fake) mount option. X-Git-Tag: nfs-utils-1-1-0-rc1~43 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=f12ed63e95dec929d6893b16983233d2940a889c Correctly handle -f (fake) mount option. 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 Signed-off-by: Neil Brown --- diff --git a/utils/mount/mount.c b/utils/mount/mount.c index 45428b0..55d60aa 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -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)