diff options
Diffstat (limited to 'networking/httpd.c')
-rw-r--r-- | networking/httpd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 779f070..1ac49e7 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -1409,10 +1409,11 @@ static void send_cgi_and_exit( /* Child process */ xfunc_error_retval = 242; + /* NB: close _first_, then move fds! */ + close(toCgi.wr); + close(fromCgi.rd); xmove_fd(toCgi.rd, 0); /* replace stdin with the pipe */ xmove_fd(fromCgi.wr, 1); /* replace stdout with the pipe */ - close(fromCgi.rd); - close(toCgi.wr); /* User seeing stderr output can be a security problem. * If CGI really wants that, it can always do dup itself. */ /* dup2(1, 2); */ |