From ced680941abd8c66e035f45983f50729e23279ad Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 26 Aug 2008 09:56:08 +0000 Subject: Fixed bug #45786 (FastCGI process exited unexpectedly) --- sapi/cgi/fastcgi.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sapi/cgi/fastcgi.c') diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index ac55672ef0..8315c0c472 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -662,6 +662,7 @@ static int fcgi_read_request(fcgi_request *req) unsigned char buf[FCGI_MAX_LENGTH+8]; req->keep = 0; + req->closed = 0; req->in_len = 0; req->out_hdr = NULL; req->out_pos = req->out_buf; @@ -886,7 +887,6 @@ int fcgi_accept_request(fcgi_request *req) HANDLE pipe; OVERLAPPED ov; #endif - fcgi_finish_request(req); while (1) { if (req->fd < 0) { @@ -1177,13 +1177,16 @@ int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int l return len; } -int fcgi_finish_request(fcgi_request *req) +int fcgi_finish_request(fcgi_request *req, int force_close) { int ret = 1; if (req->fd >= 0) { - ret = fcgi_flush(req, 1); - fcgi_close(req, 0, 1); + if (!req->closed) { + ret = fcgi_flush(req, 1); + req->closed = 1; + } + fcgi_close(req, force_close, 1); } return ret; } -- cgit v1.2.1