Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rpcbind use EXIT_SUCCESS/EXIT_FAILURE consistently.
details: https://anonhg.NetBSD.org/src/rev/14b0a7eaf069
branches: trunk
changeset: 338081:14b0a7eaf069
user: christos <christos%NetBSD.org@localhost>
date: Sat May 09 21:22:18 2015 +0000
description:
use EXIT_SUCCESS/EXIT_FAILURE consistently.
diffstat:
usr.sbin/rpcbind/rpcbind.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
diffs (93 lines):
diff -r bd687871de5a -r 14b0a7eaf069 usr.sbin/rpcbind/rpcbind.c
--- a/usr.sbin/rpcbind/rpcbind.c Sat May 09 19:51:43 2015 +0000
+++ b/usr.sbin/rpcbind/rpcbind.c Sat May 09 21:22:18 2015 +0000
@@ -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 @@
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 @@
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 @@
}
} else {
if (daemon(0, 0))
- err(1, "fork failed");
+ err(EXIT_FAILURE, "fork failed");
}
openlog("rpcbind", 0, LOG_DAEMON);
@@ -184,11 +186,11 @@
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 @@
rpcbind_abort();
/* NOTREACHED */
- return 0;
+ return EXIT_SUCCESS;
}
/*
@@ -520,7 +522,7 @@
"rpcbind terminating on signal. Restart with \"rpcbind -w\"");
write_warmstart(); /* Dump yourself */
#endif
- exit(2);
+ exit(EXIT_FAILURE);
}
void
@@ -566,7 +568,7 @@
#endif
default: /* error */
fprintf(stderr, "usage: rpcbind [-Idwils]\n");
- exit (1);
+ exit(EXIT_FAILURE);
}
}
if (doabort && !debugging) {
Home |
Main Index |
Thread Index |
Old Index