summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-09-06 21:16:12 +0000
committerjoerg <joerg@pkgsrc.org>2007-09-06 21:16:12 +0000
commit4bc871e0e3c8b05d7a49ea002028b3b59db89bb0 (patch)
treee893100e4bceed45b411b4f871fd107f8794fb52 /pkgtools
parent0c95db36aed0f2353179127480fbedf04d7fd8a0 (diff)
downloadpkgsrc-4bc871e0e3c8b05d7a49ea002028b3b59db89bb0.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.c11
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);