- Be consistent with using sysexits(3) codes.
- Turn fprintf()+exit() into errx(). Sponsored by: Fudo Security
This commit is contained in:
parent
fba0af0bf8
commit
532b3f4791
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357138
@ -53,8 +53,7 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, "usage: pwait [-t timeout] [-v] pid ...\n");
|
errx(EX_USAGE, "usage: pwait [-t timeout] [-v] pid ...");
|
||||||
exit(EX_USAGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -120,11 +119,11 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
kq = kqueue();
|
kq = kqueue();
|
||||||
if (kq == -1)
|
if (kq == -1)
|
||||||
err(1, "kqueue");
|
err(EX_OSERR, "kqueue");
|
||||||
|
|
||||||
e = malloc((argc + tflag) * sizeof(struct kevent));
|
e = malloc((argc + tflag) * sizeof(struct kevent));
|
||||||
if (e == NULL)
|
if (e == NULL)
|
||||||
err(1, "malloc");
|
err(EX_OSERR, "malloc");
|
||||||
nleft = 0;
|
nleft = 0;
|
||||||
for (n = 0; n < argc; n++) {
|
for (n = 0; n < argc; n++) {
|
||||||
s = argv[n];
|
s = argv[n];
|
||||||
@ -166,12 +165,12 @@ main(int argc, char *argv[])
|
|||||||
while (nleft > 0) {
|
while (nleft > 0) {
|
||||||
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
|
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
|
||||||
if (n == -1)
|
if (n == -1)
|
||||||
err(1, "kevent");
|
err(EX_OSERR, "kevent");
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (e[i].filter == EVFILT_SIGNAL) {
|
if (e[i].filter == EVFILT_SIGNAL) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("timeout\n");
|
printf("timeout\n");
|
||||||
return (124);
|
exit(124);
|
||||||
}
|
}
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
status = e[i].data;
|
status = e[i].data;
|
||||||
|
Loading…
Reference in New Issue
Block a user