From: Steve Dickson Date: Fri, 16 Mar 2007 06:08:04 +0000 (+1100) Subject: Return the correct exit status on failed mounts X-Git-Tag: nfs-utils-1-1-0-rc1~60 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=4af6588d57ab60454500b6789c87586bf0f69fe3;p=nfs-utils.git Return the correct exit status on failed mounts Signed-off-by: Steve Dickson Signed-off-by: Neil Brown --- diff --git a/utils/mount/mount.c b/utils/mount/mount.c index 7d58ef6..72cb89d 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -392,19 +392,25 @@ int main(int argc, char *argv[]) start_statd(); } - if (!mnt_err && !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(-1); - } + if (fake) + return 0; + if (mnt_err) + exit(EX_FAIL); - if(!nomtab) - add_mtab(spec, mount_point, nfs_mount_vers == 4 ? "nfs4" : "nfs", - flags, extra_opts, 0, 0); + 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) + add_mtab(spec, mount_point, + nfs_mount_vers == 4 ? "nfs4" : "nfs", + flags, extra_opts, 0, 0); + return 0; }