]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix longstanding BS2000(OSD_POSIX) related bug -- a CGI program which
authorMartin Kraemer <martin@apache.org>
Wed, 5 Mar 2003 15:50:29 +0000 (15:50 +0000)
committerMartin Kraemer <martin@apache.org>
Wed, 5 Mar 2003 15:50:29 +0000 (15:50 +0000)
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

src/support/suexec.c

index 54126ba08bf139c881b6076faeb9e308e7ffba19..a43b1a4b1f47e733e9491122e13d4f40e40c4b0e 100644 (file)
@@ -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)) {