summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2017-09-10 22:10:12 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2017-09-10 22:10:12 -0400
commitcf4bc764dcb549cf3fb1df80a1c2f0393f834864 (patch)
tree72cedac56615fb865a271dd2a2cfcf9c3be76e63
parente951152e2b54831d2cb1d325c237f8462713b953 (diff)
downloadlighttpd1.4-cf4bc764dcb549cf3fb1df80a1c2f0393f834864.tar.gz
lighttpd1.4-cf4bc764dcb549cf3fb1df80a1c2f0393f834864.zip
[mod_cgi] omit cgi_handle_fdevent after proc exit
Omit calling cgi_handle_fdevent() after CGI process exit. Another (sub)process may be holding pipe fd open and might write response instead of the initial CGI process.
-rw-r--r--src/mod_cgi.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/mod_cgi.c b/src/mod_cgi.c
index a611dbcc..d5f7596f 100644
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -1019,6 +1019,7 @@ static handler_t cgi_waitpid_cb(server *srv, void *p_d, pid_t pid, int status) {
if (pid != p->cgi_pid.ptr[i].pid) continue;
hctx = (handler_ctx *)p->cgi_pid.ptr[i].ctx;
+ if (hctx) hctx->pid = -1;
cgi_pid_del(p, i);
if (WIFEXITED(status)) {
@@ -1036,11 +1037,6 @@ static handler_t cgi_waitpid_cb(server *srv, void *p_d, pid_t pid, int status) {
"CGI pid", pid, "ended unexpectedly");
}
- if (hctx) {
- hctx->pid = -1;
- cgi_handle_fdevent(srv, hctx, FDEVENT_IN|FDEVENT_HUP);
- }
-
return HANDLER_FINISHED;
}