From: Martin Kraemer Date: Wed, 5 Mar 2003 15:50:29 +0000 (+0000) Subject: Fix longstanding BS2000(OSD_POSIX) related bug -- a CGI program which X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de8d82753bccc9b99212f6ffbd4be52b4ec822c9;p=thirdparty%2Fapache%2Fhttpd.git Fix longstanding BS2000(OSD_POSIX) related bug -- a CGI program which terminated quickly would cause an endless loop. ;-) Nobody noticed by now, so I guess few people used it. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@98892 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/support/suexec.c b/src/support/suexec.c index 54126ba08bf..a43b1a4b1f4 100644 --- a/src/support/suexec.c +++ b/src/support/suexec.c @@ -419,7 +419,7 @@ int main(int argc, char *argv[]) * Initialize BS2000 user environment */ { - pid_t pid; + pid_t pid, reaped; int status; switch (pid = ufork(target_uname)) @@ -432,7 +432,8 @@ int main(int argc, char *argv[]) case 0: /* Child */ break; default: /* Father */ - while (pid != waitpid(pid, &status, 0)) + while (pid != (reaped = waitpid(pid, &status, 0)) + && (reaped != -1 || errno != ECHILD)) ; /* @@@ FIXME: should we deal with STOP signals as well? */ if (WIFSIGNALED(status)) {