From 4bc871e0e3c8b05d7a49ea002028b3b59db89bb0 Mon Sep 17 00:00:00 2001 From: joerg Date: Thu, 6 Sep 2007 21:16:12 +0000 Subject: If waitpid was interrupt for some reason, restart it. Error out on all other negative return values or when errno != EINTR. --- pkgtools/pkg_install/files/lib/pexec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pkgtools') 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); -- cgit v1.2.3