fat                                      Sat, 18 Dec 2010 11:22:11 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306426

Log:
- Fixed bug #53527 (php-fpm --test doesn't set a valuable return value).

Bug: http://bugs.php.net/53527 (Open) php-fpm --test doesn't set a valuable 
return value
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c
    U   php/php-src/trunk/sapi/fpm/fpm/fpm.c
    U   php/php-src/trunk/sapi/fpm/fpm/fpm.h
    U   php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-12-18 10:13:28 UTC (rev 306425)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-12-18 11:22:11 UTC (rev 306426)
@@ -56,6 +56,9 @@
 - Phar Extension:
   . Fixed bug #53541 (format string bug in ext/phar).
     (crrodriguez at opensuse dot org, Ilia)
+
+- PHP-FPM SAPI:
+  . Fixed bug #53527 (php-fpm --test doesn't set a valuable return value). 
(fat)

 - SPL extension:
   . Fixed bug #53515 (property_exists incorrect on ArrayObject null and 0

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c     2010-12-18 10:13:28 UTC 
(rev 306425)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.c     2010-12-18 11:22:11 UTC 
(rev 306426)
@@ -21,7 +21,20 @@
 #include "fpm_stdio.h"
 #include "zlog.h"

-struct fpm_globals_s fpm_globals;
+struct fpm_globals_s fpm_globals = {
+               .parent_pid = 0,
+               .argc = NULL,
+               .argv = NULL,
+               .config = NULL,
+               .prefix = NULL,
+               .running_children = 0,
+               .error_log_fd = 0,
+               .log_level = 0,
+               .listening_socket = 0,
+               .max_requests = 0,
+               .is_child = 0,
+               .test_successful = 0
+       };

 int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf) 
/* {{{ */
 {
@@ -43,7 +56,12 @@
                0 > fpm_sockets_init_main()          ||
                0 > fpm_worker_pool_init_main()      ||
                0 > fpm_event_init_main()) {
-               return -1;
+
+               if (fpm_globals.test_successful) {
+                       exit(0);
+               } else {
+                       return -1;
+               }
        }

        if (0 > fpm_conf_write_pid()) {

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h     2010-12-18 10:13:28 UTC 
(rev 306425)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h     2010-12-18 11:22:11 UTC 
(rev 306426)
@@ -22,6 +22,7 @@
        int listening_socket; /* for this child */
        int max_requests; /* for this child */
        int is_child;
+       int test_successful;
 };

 extern struct fpm_globals_s fpm_globals;

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c        2010-12-18 
10:13:28 UTC (rev 306425)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c        2010-12-18 
11:22:11 UTC (rev 306426)
@@ -1218,6 +1218,7 @@
                        fpm_conf_dump();
                }
                zlog(ZLOG_NOTICE, "configuration file %s test is successful\n", 
fpm_globals.config);
+               fpm_globals.test_successful = 1;
                return -1;
        }


Modified: php/php-src/trunk/sapi/fpm/fpm/fpm.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm.c        2010-12-18 10:13:28 UTC (rev 
306425)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm.c        2010-12-18 11:22:11 UTC (rev 
306426)
@@ -21,7 +21,20 @@
 #include "fpm_stdio.h"
 #include "zlog.h"

-struct fpm_globals_s fpm_globals;
+struct fpm_globals_s fpm_globals = {
+               .parent_pid = 0,
+               .argc = NULL,
+               .argv = NULL,
+               .config = NULL,
+               .prefix = NULL,
+               .running_children = 0,
+               .error_log_fd = 0,
+               .log_level = 0,
+               .listening_socket = 0,
+               .max_requests = 0,
+               .is_child = 0,
+               .test_successful = 0
+       };

 int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf) 
/* {{{ */
 {
@@ -43,7 +56,12 @@
                0 > fpm_sockets_init_main()          ||
                0 > fpm_worker_pool_init_main()      ||
                0 > fpm_event_init_main()) {
-               return -1;
+
+               if (fpm_globals.test_successful) {
+                       exit(0);
+               } else {
+                       return -1;
+               }
        }

        if (0 > fpm_conf_write_pid()) {

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm.h
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm.h        2010-12-18 10:13:28 UTC (rev 
306425)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm.h        2010-12-18 11:22:11 UTC (rev 
306426)
@@ -22,6 +22,7 @@
        int listening_socket; /* for this child */
        int max_requests; /* for this child */
        int is_child;
+       int test_successful;
 };

 extern struct fpm_globals_s fpm_globals;

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c   2010-12-18 10:13:28 UTC (rev 
306425)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c   2010-12-18 11:22:11 UTC (rev 
306426)
@@ -1218,6 +1218,7 @@
                        fpm_conf_dump();
                }
                zlog(ZLOG_NOTICE, "configuration file %s test is successful\n", 
fpm_globals.config);
+               fpm_globals.test_successful = 1;
                return -1;
        }


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to