diff options
author | bcook <bcook@cvs.openbsd.org> | 2014-07-09 14:32:25 +0000 |
---|---|---|
committer | bcook <bcook@cvs.openbsd.org> | 2014-07-09 14:32:25 +0000 |
commit | e0334fbf1d750e20e5d55dbaefad751fa3300720 (patch) | |
tree | 97dbab7f2a8f887a297455e2ca630f6c8c6fb346 /regress | |
parent | 0db66873874fdf3297cc211ba46de9dc6df6cbdb (diff) |
check for EINTR when calling waitpid.
ok jsing@
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libc/arc4random-fork/arc4random-fork.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/regress/lib/libc/arc4random-fork/arc4random-fork.c b/regress/lib/libc/arc4random-fork/arc4random-fork.c index 35a9ea6a980..af617af6251 100644 --- a/regress/lib/libc/arc4random-fork/arc4random-fork.c +++ b/regress/lib/libc/arc4random-fork/arc4random-fork.c @@ -18,6 +18,7 @@ #include <sys/wait.h> #include <assert.h> #include <err.h> +#include <errno.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -71,6 +72,16 @@ usage() errx(1, "usage: %s [-bp]", __progname); } +static pid_t +_waitpid(pid_t pid, int *stat_loc, int options) +{ + pid_t ret; + do { + ret = waitpid(pid, stat_loc, options); + } while (ret == -1 && errno == EINTR); + return ret; +} + int main(int argc, char *argv[]) { @@ -123,11 +134,11 @@ main(int argc, char *argv[]) fillbuf(bufparent); - CHECK_EQ(pidone, waitpid(pidone, &status, 0)); + CHECK_EQ(pidone, _waitpid(pidone, &status, 0)); CHECK(WIFEXITED(status)); CHECK_EQ(0, WEXITSTATUS(status)); - CHECK_EQ(pidtwo, waitpid(pidtwo, &status, 0)); + CHECK_EQ(pidtwo, _waitpid(pidtwo, &status, 0)); CHECK(WIFEXITED(status)); CHECK_EQ(0, WEXITSTATUS(status)); |