pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib If waitpid was interrup...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7a302a2ed746
branches:  trunk
changeset: 533005:7a302a2ed746
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Thu Sep 06 21:16:12 2007 +0000

description:
If waitpid was interrupt for some reason, restart it. Error out on all
other negative return values or when errno != EINTR.

diffstat:

 pkgtools/pkg_install/files/lib/pexec.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (22 lines):

diff -r 1bd421930c8c -r 7a302a2ed746 pkgtools/pkg_install/files/lib/pexec.c
--- a/pkgtools/pkg_install/files/lib/pexec.c    Thu Sep 06 21:08:08 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/pexec.c    Thu Sep 06 21:16:12 2007 +0000
@@ -93,12 +93,13 @@
        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);



Home | Main Index | Thread Index | Old Index