diff options
author | joerg <joerg@pkgsrc.org> | 2007-09-06 21:16:12 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2007-09-06 21:16:12 +0000 |
commit | 5c78e109084fccbd26a74164488456e5bc778599 (patch) | |
tree | e893100e4bceed45b411b4f871fd107f8794fb52 /pkgtools | |
parent | 06fc16100295c8bc7bcb00712abca79ebdd5bedb (diff) | |
download | pkgsrc-5c78e109084fccbd26a74164488456e5bc778599.tar.gz |
If waitpid was interrupt for some reason, restart it. Error out on all
other negative return values or when errno != EINTR.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_install/files/lib/pexec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pkgtools/pkg_install/files/lib/pexec.c b/pkgtools/pkg_install/files/lib/pexec.c index b5b3019ac65..1358aedb910 100644 --- a/pkgtools/pkg_install/files/lib/pexec.c +++ b/pkgtools/pkg_install/files/lib/pexec.c @@ -93,12 +93,13 @@ int pipe_to_system_end(pipe_to_system_t *to_pipe) int wait_ret; fclose(to_pipe->fp); - wait_ret = waitpid(to_pipe->pid, &status, 0); + do { + wait_ret = waitpid(to_pipe->pid, &status, 0); + } while (wait_ret == -1 && errno == EINTR); + if (wait_ret < 0) { - if (errno != EINTR) { - call_callback(to_pipe->cleanup); - errx(2, "waitpid returned failure"); - } + call_callback(to_pipe->cleanup); + errx(2, "waitpid returned failure"); } if (!WIFEXITED(status)) { call_callback(to_pipe->cleanup); |