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:
Guru Prasad Srinivasa 2016-03-08 18:53:33 -05:00
parent aa4c87a2fa
commit eb7ad5609d

View File

@ -133,13 +133,13 @@ dowait(int nowait, int pid)
if (!nowait) {
if (waitpid(pid, &x, 0)<0) {
warn("waitpid");
errx(1, "waitpid");
}
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) {
warnx("pid %d: exit %d", pid, WEXITSTATUS(x));
errx(1, "pid %d: exit %d", pid, WEXITSTATUS(x));
}
}
}