Make forktest fail if waitpid() fails
Previously, forktest would only warn if the calls to waitpid() returned errors. Now, forktest terminates on the first error.
This commit is contained in:
parent
aa4c87a2fa
commit
eb7ad5609d
@ -133,13 +133,13 @@ dowait(int nowait, int pid)
|
|||||||
|
|
||||||
if (!nowait) {
|
if (!nowait) {
|
||||||
if (waitpid(pid, &x, 0)<0) {
|
if (waitpid(pid, &x, 0)<0) {
|
||||||
warn("waitpid");
|
errx(1, "waitpid");
|
||||||
}
|
}
|
||||||
else if (WIFSIGNALED(x)) {
|
else if (WIFSIGNALED(x)) {
|
||||||
warnx("pid %d: signal %d", pid, WTERMSIG(x));
|
errx(1, "pid %d: signal %d", pid, WTERMSIG(x));
|
||||||
}
|
}
|
||||||
else if (WEXITSTATUS(x) != 0) {
|
else if (WEXITSTATUS(x) != 0) {
|
||||||
warnx("pid %d: exit %d", pid, WEXITSTATUS(x));
|
errx(1, "pid %d: exit %d", pid, WEXITSTATUS(x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user