Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > by-pkgid > ec1353c51cf2bd4d46fb842cdb5d4cdc > files > 7

nfs-utils-1.0.12-13mdv2007.1.src.rpm

commit 200d810e3fa2c7f35932faac87a6409fac5a9d4d

From: Steve Dickson <steved@redhat.com>

Return the correct exit status on failed mounts

    Signed-off-by: Steve Dickson <steved@redhat.com>
---

 utils/mount/mount.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index 13bffbc..8440055 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -472,21 +472,24 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	if (!mnt_err && !fake) {
-		if(!(flags & MS_REMOUNT)) {
-			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(!nomtab) {
-			add_mtab(spec, mount_point, nfs_mount_vers == 4 ? "nfs4" : "nfs",
-				 flags, extra_opts, 0, 0);
+	if (fake)
+		return 0;
+	if (mnt_err)
+		exit(EX_FAIL);
+
+	if(!(flags & MS_REMOUNT)) {
+		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;
 }