diff options
author | Justin Erenkrantz <jerenkrantz@apache.org> | 2003-02-17 08:04:50 +0100 |
---|---|---|
committer | Justin Erenkrantz <jerenkrantz@apache.org> | 2003-02-17 08:04:50 +0100 |
commit | 1a344d46b69651bba195d62c547cce259cdb99a9 (patch) | |
tree | 78d50c4c9cb26a743a140601a1596d959214011a /server/main.c | |
parent | Rework ap_xml_parse_input to work with bucket brigades rather than doing all (diff) | |
download | apache2-1a344d46b69651bba195d62c547cce259cdb99a9.tar.xz apache2-1a344d46b69651bba195d62c547cce259cdb99a9.zip |
Allow restart of httpd to occur even with syntax errors in the config
file. (Out-of-date DSOs with bad MMNs will still be fatal unfortunately.)
Add return parameter to ap_process_config_tree - OK on success, !OK on
syntax error. We will no longer call exit() from ap_process_config_tree.
The caller must exit if there is an error (makes sense anyway). This allows
the initial start-up code to delay the exit until trying to let the
signal_server optional function execute first.
(The chances are that the syntax error isn't in the PidFile directive. If
that happens, we'll try the default one. Oh, well.)
PR: 16813
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | server/main.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/server/main.c b/server/main.c index a2cbcc3717..5472160b63 100644 --- a/server/main.c +++ b/server/main.c @@ -573,13 +573,16 @@ int main(int argc, const char * const argv[]) destroy_and_exit_process(process, 1); } - ap_process_config_tree(server_conf, ap_conftree, process->pconf, ptemp); - ap_fixup_virtual_hosts(pconf, server_conf); - ap_fini_vhost_config(pconf, server_conf); - apr_hook_sort_all(); - if (configtestonly) { - ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Syntax OK"); - destroy_and_exit_process(process, 0); + rv = ap_process_config_tree(server_conf, ap_conftree, + process->pconf, ptemp); + if (rv == OK) { + ap_fixup_virtual_hosts(pconf, server_conf); + ap_fini_vhost_config(pconf, server_conf); + apr_hook_sort_all(); + if (configtestonly) { + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Syntax OK"); + destroy_and_exit_process(process, 0); + } } signal_server = APR_RETRIEVE_OPTIONAL_FN(ap_signal_server); @@ -591,6 +594,11 @@ int main(int argc, const char * const argv[]) } } + /* If our config failed, deal with that here. */ + if (rv != OK) { + destroy_and_exit_process(process, 1); + } + apr_pool_clear(plog); if ( ap_run_open_logs(pconf, plog, ptemp, server_conf) != OK) { @@ -630,7 +638,10 @@ int main(int argc, const char * const argv[]) destroy_and_exit_process(process, 1); } - ap_process_config_tree(server_conf, ap_conftree, process->pconf, ptemp); + if (ap_process_config_tree(server_conf, ap_conftree, process->pconf, + ptemp) != OK) { + destroy_and_exit_process(process, 1); + } ap_fixup_virtual_hosts(pconf, server_conf); ap_fini_vhost_config(pconf, server_conf); apr_hook_sort_all(); |