]> granicus.if.org Git - php/commitdiff
Fixed bug #40414 (possivle endless fork() loop when running fastcgi)
authorDmitry Stogov <dmitry@php.net>
Thu, 15 Feb 2007 12:33:16 +0000 (12:33 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 15 Feb 2007 12:33:16 +0000 (12:33 +0000)
NEWS
sapi/cgi/cgi_main.c
sapi/cgi/fastcgi.c
sapi/cgi/fastcgi.h

diff --git a/NEWS b/NEWS
index 761831cc1605246311aa8b8e707329a950feff43..6dc370886cc42002ab7398c6c49a7e8c5a15327a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ PHP                                                                        NEWS
 - Fixed bug #40451 (addAttribute() may crash when used with non-existent child 
   node). (Tony)
 - Fixed bug #40428 (imagepstext() doesn't accept optional parameter). (Pierre)
+- Fixed bug #40414 (possible endless fork() loop when running fastcgi).
+  (Dmitry)
 - Fixed bug #40410 (ext/posix does not compile on MacOS 10.3.9). (Tony)
 - Fixed Bug #40352 (FCGI_WEB_SERVER_ADDRS function get lost). (Dmitry)
 - Fixed bug #40236 (php -a function allocation eats memory). (Dmitry)
index 65c3e28dd174a4e9973b33058db18dded4987a41..f8375fd3c4d2f21e43f1b6e3ce9adf60095628d8 100644 (file)
@@ -1392,6 +1392,10 @@ consult the installation file that came with this distribution, or visit \n\
                        exit(1);
                }
 
+               if (fcgi_in_shutdown()) {
+                       exit(0);
+               }
+
                while (parent) {
                        do {
 #ifdef DEBUG_FASTCGI
index 743c90eee942091a68ee329e78c6c27261537288..06885bc24454cc04192ada39617d8b44a386d248 100644 (file)
@@ -164,6 +164,11 @@ static void fcgi_signal_handler(int signo)
 
 #endif
 
+int fcgi_in_shutdown(void)
+{
+       return in_shutdown;
+}
+
 int fcgi_init(void)
 {
        if (!is_initialized) {
index 8a0c29f3dc923f1df139e9af4726074dd5e9f4c3..940a9be55b95720a6fc8cbdbe0c83fc145452f5d 100644 (file)
@@ -110,6 +110,7 @@ typedef struct _fcgi_request {
 
 int fcgi_init(void);
 int fcgi_is_fastcgi(void);
+int fcgi_in_shutdown(void);
 int fcgi_listen(const char *path, int backlog);
 void fcgi_init_request(fcgi_request *req, int listen_socket);
 int fcgi_accept_request(fcgi_request *req);