svn commit: r357138 - head/bin/pwait
Pawel Jakub Dawidek
pjd at FreeBSD.org
Sun Jan 26 10:49:24 UTC 2020
Author: pjd
Date: Sun Jan 26 10:49:24 2020
New Revision: 357138
URL: https://svnweb.freebsd.org/changeset/base/357138
Log:
- Be consistent with using sysexits(3) codes.
- Turn fprintf()+exit() into errx().
Sponsored by: Fudo Security
Modified:
head/bin/pwait/pwait.c
Modified: head/bin/pwait/pwait.c
==============================================================================
--- head/bin/pwait/pwait.c Sun Jan 26 07:24:49 2020 (r357137)
+++ head/bin/pwait/pwait.c Sun Jan 26 10:49:24 2020 (r357138)
@@ -53,8 +53,7 @@ static void
usage(void)
{
- fprintf(stderr, "usage: pwait [-t timeout] [-v] pid ...\n");
- exit(EX_USAGE);
+ errx(EX_USAGE, "usage: pwait [-t timeout] [-v] pid ...");
}
/*
@@ -120,11 +119,11 @@ main(int argc, char *argv[])
kq = kqueue();
if (kq == -1)
- err(1, "kqueue");
+ err(EX_OSERR, "kqueue");
e = malloc((argc + tflag) * sizeof(struct kevent));
if (e == NULL)
- err(1, "malloc");
+ err(EX_OSERR, "malloc");
nleft = 0;
for (n = 0; n < argc; n++) {
s = argv[n];
@@ -166,12 +165,12 @@ main(int argc, char *argv[])
while (nleft > 0) {
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
if (n == -1)
- err(1, "kevent");
+ err(EX_OSERR, "kevent");
for (i = 0; i < n; i++) {
if (e[i].filter == EVFILT_SIGNAL) {
if (verbose)
printf("timeout\n");
- return (124);
+ exit(124);
}
if (verbose) {
status = e[i].data;
More information about the svn-src-head
mailing list