summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2020-01-26 10:49:24 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2020-01-26 10:49:24 +0000
commit532b3f47916726029a5bc2df405089de9c6d7c0d (patch)
tree230f4ddd587b1e7705d62b392361ad1b67471622 /bin
parentfba0af0bf897541b88fa66a9fb9225573f49dd9c (diff)
downloadsrc-test-532b3f47916726029a5bc2df405089de9c6d7c0d.tar.gz
src-test-532b3f47916726029a5bc2df405089de9c6d7c0d.zip
- Be consistent with using sysexits(3) codes.
- Turn fprintf()+exit() into errx(). Sponsored by: Fudo Security
Notes
Notes: svn path=/head/; revision=357138
Diffstat (limited to 'bin')
-rw-r--r--bin/pwait/pwait.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/pwait/pwait.c b/bin/pwait/pwait.c
index 76989c9193713..e31db4dded1f4 100644
--- a/bin/pwait/pwait.c
+++ b/bin/pwait/pwait.c
@@ -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;