Commit fde2c709 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add some rather bogus code to close all the fd's (except 0,1,2) before

execing the program. We had a problem with daemons that detach and
continue to run, holding open all of the same FDs that the web server
had open, including the httpd socket! So it was not possible to
restart the web server cause processes were parked on the socket
holding it open.

I think this is the wrong place for this since there numerous ways to
run programs from the web server, and using suexec is optional (can
just run programs directly). Seems like a problem with php instead,
but the fix is here cause it will solve the problem for us.
parent 7eec2a8d
......@@ -278,6 +278,18 @@ int main(int argc, char *argv[])
* outout sent to stderr, so make sure it all goes to stdout.
dup2(1, 2);
int i, max;
* Close all other descriptors. I think this is the wrong
* place for this since a program can be run from the web
* server without going through suexec!
max = getdtablesize();
for (i = 3; i < max; i++)
(void) close(i);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment