File 0001-nfsstats-fix-some-exit-codes.patch of Package nfs-utils.12300

From 9e12e221ead6d869977b43a99e4a7d13a33d82ee Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 11 Jan 2017 11:08:36 -0500
Subject: [PATCH] nfsstats: fix some exit codes.

"nfsstat -m" always exits with "1" (unless there is an error opening
/proc/mounts).  It should exist "0".

Also, a few usage errors cause an exit of "255" when it should probably
be "1".

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/nfsstat/nfsstat.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/utils/nfsstat/nfsstat.c
+++ b/utils/nfsstat/nfsstat.c
@@ -348,7 +348,7 @@ main(int argc, char **argv)
 		switch (c) {
 		case 'a':
 			fprintf(stderr, "nfsstat: nfs acls are not yet supported.\n");
-			return -1;
+			return 1;
 		case 'c':
 			opt_clt = 1;
 			break;
@@ -410,7 +410,7 @@ main(int argc, char **argv)
 					"not yet supported\n");
 			return 2;
 		case 'm':
-			return mounts(MOUNTSFILE);
+			return ! mounts(MOUNTSFILE);
 		case '\1':
 			usage(progname);
 			return 0;
@@ -419,7 +419,7 @@ main(int argc, char **argv)
 			return 0;
 		default:
 			printf("Try `%s --help' for more information.\n", progname);
-			return -1;
+			return 1;
 		}
 	}
openSUSE Build Service is sponsored by