Module Name:    src
Committed By:   christos
Date:           Sat May  9 21:22:18 UTC 2015

Modified Files:
        src/usr.sbin/rpcbind: rpcbind.c

Log Message:
use EXIT_SUCCESS/EXIT_FAILURE consistently.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/rpcbind/rpcbind.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/rpcbind/rpcbind.c
diff -u src/usr.sbin/rpcbind/rpcbind.c:1.21 src/usr.sbin/rpcbind/rpcbind.c:1.22
--- src/usr.sbin/rpcbind/rpcbind.c:1.21	Sat May  9 14:22:37 2015
+++ src/usr.sbin/rpcbind/rpcbind.c	Sat May  9 17:22:18 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcbind.c,v 1.21 2015/05/09 18:22:37 dholland Exp $	*/
+/*	$NetBSD: rpcbind.c,v 1.22 2015/05/09 21:22:18 christos Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -118,18 +118,20 @@ main(int argc, char *argv[])
 
 	parseargs(argc, argv);
 
-	if (getrlimit(RLIMIT_NOFILE, &rl) != -1 && rl.rlim_cur < 128) {
+	if (getrlimit(RLIMIT_NOFILE, &rl) == -1)
+		err(EXIT_FAILURE, "getrlimit(RLIMIT_NOFILE)");
+
+	if (rl.rlim_cur < 128) {
 		if (rl.rlim_max <= 128)
 			rl.rlim_cur = rl.rlim_max;
 		else
 			rl.rlim_cur = 128;
-		if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
+		if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
 			err(EXIT_FAILURE, "setrlimit(RLIMIT_NOFILE)");
-		}
 	}
 	nc_handle = setnetconfig(); 	/* open netconfig file */
 	if (nc_handle == NULL)
-		errx(1, "could not read /etc/netconfig");
+		errx(EXIT_FAILURE, "could not read /etc/netconfig");
 #ifdef PORTMAP
 	udptrans = "";
 	tcptrans = "";
@@ -137,7 +139,7 @@ main(int argc, char *argv[])
 
 	nconf = getnetconfigent("local");
 	if (nconf == NULL)
-		errx(1, "can't find local transport");
+		errx(EXIT_FAILURE, "can't find local transport");
 
 	rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
 
@@ -173,7 +175,7 @@ main(int argc, char *argv[])
 		}
 	} else {
 		if (daemon(0, 0))
-			err(1, "fork failed");
+			err(EXIT_FAILURE, "fork failed");
 	}
 
 	openlog("rpcbind", 0, LOG_DAEMON);
@@ -184,11 +186,11 @@ main(int argc, char *argv[])
 
 		if((p = getpwnam(RUN_AS)) == NULL) {
 			syslog(LOG_ERR, "cannot get uid of daemon: %m");
-			exit(1);
+			exit(EXIT_FAILURE);
 		}
 		if (setuid(p->pw_uid) == -1) {
 			syslog(LOG_ERR, "setuid to daemon failed: %m");
-			exit(1);
+			exit(EXIT_FAILURE);
 		}
 	}
 
@@ -199,7 +201,7 @@ main(int argc, char *argv[])
 	rpcbind_abort();
 	/* NOTREACHED */
 
-	return 0;
+	return EXIT_SUCCESS;
 }
 
 /*
@@ -520,7 +522,7 @@ terminate(int dummy)
 		"rpcbind terminating on signal. Restart with \"rpcbind -w\"");
 	write_warmstart();	/* Dump yourself */
 #endif
-	exit(2);
+	exit(EXIT_FAILURE);
 }
 
 void
@@ -566,7 +568,7 @@ parseargs(int argc, char *argv[])
 #endif
 		default:	/* error */
 			fprintf(stderr,	"usage: rpcbind [-Idwils]\n");
-			exit (1);
+			exit(EXIT_FAILURE);
 		}
 	}
 	if (doabort && !debugging) {

Reply via email to