Fixed a bug in the waitpid version where it would return incorrectly if a
authorJon Steinhart <jon@fourwinds.com>
Wed, 20 Nov 2002 19:57:19 +0000 (19:57 +0000)
committerJon Steinhart <jon@fourwinds.com>
Wed, 20 Nov 2002 19:57:19 +0000 (19:57 +0000)
child process was interrupted.

sbr/pidwait.c

index a1555bb..1572bfe 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <h/mh.h>
 #include <h/signals.h>
+#include <errno.h>
 #include <signal.h>
 
 #ifdef HAVE_SYS_WAIT_H
@@ -36,7 +37,8 @@ pidwait (pid_t id, int sigsok)
     }
 
 #ifdef HAVE_WAITPID
-    pid = waitpid(id, &status, 0);
+    while ((pid = waitpid(id, &status, 0)) == -1 && errno == EINTR)
+       ;
 #else
     while ((pid = wait(&status)) != -1 && pid != id)
        continue;