From 5d9826b5df86f270974b004a7ed021cfb02f6879 Mon Sep 17 00:00:00 2001 From: bcook <> Date: Wed, 9 Jul 2014 14:32:24 +0000 Subject: check for EINTR when calling waitpid. ok jsing@ --- src/regress/lib/libc/arc4random-fork/arc4random-fork.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/regress/lib/libc/arc4random-fork/arc4random-fork.c b/src/regress/lib/libc/arc4random-fork/arc4random-fork.c index 35a9ea6a98..af617af625 100644 --- a/src/regress/lib/libc/arc4random-fork/arc4random-fork.c +++ b/src/regress/lib/libc/arc4random-fork/arc4random-fork.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -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)); -- cgit v1.2.3-55-g6feb