summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Loyet <fat@php.net>2010-12-18 11:22:11 +0000
committerJérôme Loyet <fat@php.net>2010-12-18 11:22:11 +0000
commite1dee992ee18120751b02fe4199f64ab16880718 (patch)
treeb9dd691f7efd22119294b3e95122a5b878850196
parent9a52c2f37081bd11bc2a41ce6a2f01286a752b88 (diff)
downloadphp-git-e1dee992ee18120751b02fe4199f64ab16880718.tar.gz
- Fixed bug #53527 (php-fpm --test doesn't set a valuable return value).
-rw-r--r--sapi/fpm/fpm/fpm.c22
-rw-r--r--sapi/fpm/fpm/fpm.h1
-rw-r--r--sapi/fpm/fpm/fpm_conf.c1
3 files changed, 22 insertions, 2 deletions
diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c
index 17a215c888..f9d2a75b6d 100644
--- a/sapi/fpm/fpm/fpm.c
+++ b/sapi/fpm/fpm/fpm.c
@@ -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 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, int test_conf) /
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()) {
diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h
index 63e3bacca4..f06d9ed6a9 100644
--- a/sapi/fpm/fpm/fpm.h
+++ b/sapi/fpm/fpm/fpm.h
@@ -22,6 +22,7 @@ struct fpm_globals_s {
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;
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index f38227c2f2..5d6fe770cd 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -1218,6 +1218,7 @@ int fpm_conf_init_main(int test_conf) /* {{{ */
fpm_conf_dump();
}
zlog(ZLOG_NOTICE, "configuration file %s test is successful\n", fpm_globals.config);
+ fpm_globals.test_successful = 1;
return -1;
}