[busybox][patch] httpd.c - CGI scripts can't fork

Jon Nalley jnalley-lists at nalleynet.com
Sun May 16 07:34:22 UTC 2004


I ran into some problems calling a CGI that forks.  Here is the issue:

Because of the signal(SIGCHLD, SIG_IGN) in openServer() the forked CGI
process is unable to catch SIGCHLD and reap it's own children (and get
their exit status).  I added signal(SIGCHLD, SIG_DFL); just before the
execv() in sendCgi() and this fixed it.

I don't believe the waitpid() in sendCgi() ever gets called though... 
Perhaps it would be better to add the signal(SIGCHLD, SIG_DFL); just
before the fork() in sendCgi()?

--- httpd.c.orig        Sun May 16 02:20:37 2004
+++ httpd.c     Sun May 16 02:30:00 2004
@@ -1169,6 +1169,7 @@
                  // now run the program.  If it fails,
                  // use _exit() so no destructors
                  // get called and make a mess.
+                 signal(SIGCHLD, SIG_DFL);
                  execv(realpath_buff, argp);
                }
            }

-- 
Jon Nalley




More information about the busybox mailing list