summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2023-03-14 15:48:41 +0000
committerYann Ylavic <ylavic@apache.org>2023-03-14 15:48:41 +0000
commitfeb15a2eb57e28d896b27a83c0e80f079a8ea509 (patch)
tree7753a37623233ee7e50a2a4cd07568bfb501d511 /server
parentd51326e797fcf61fedecfa5126bf56723a36967a (diff)
downloadhttpd-feb15a2eb57e28d896b27a83c0e80f079a8ea509.tar.gz
core: Set ap_server_conf ASAP.
* server/config.c(ap_read_config): Set ap_server_conf as soon as it exists (with defaults). * server/main.c(main): Now that ap_server_conf is set by ap_read_config(), just make sure it's not NULL afterward with an ap_assert()ion. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908393 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/config.c3
-rw-r--r--server/main.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/server/config.c b/server/config.c
index 5f88ea5718..b59fea1d4f 100644
--- a/server/config.c
+++ b/server/config.c
@@ -2308,6 +2308,9 @@ AP_DECLARE(server_rec*) ap_read_config(process_rec *process, apr_pool_t *ptemp,
if (s == NULL) {
return s;
}
+ if (ap_server_conf == NULL) {
+ ap_server_conf = s;
+ }
init_config_globals(p);
diff --git a/server/main.c b/server/main.c
index 9512ea141a..5bc3b659e9 100644
--- a/server/main.c
+++ b/server/main.c
@@ -717,8 +717,7 @@ static void usage(process_rec *process)
if (temp_error_log) {
ap_replace_stderr_log(process->pool, temp_error_log);
}
- ap_server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
- if (!ap_server_conf) {
+ if (!ap_read_config(process, ptemp, confname, &ap_conftree)) {
if (showcompile) {
/* Well, we tried. Show as much as we can, but exit nonzero to
* indicate that something's not right. The cause should have
@@ -727,6 +726,7 @@ static void usage(process_rec *process)
}
destroy_and_exit_process(process, 1);
}
+ ap_assert(ap_server_conf != NULL);
apr_pool_cleanup_register(pconf, &ap_server_conf, ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
@@ -824,10 +824,10 @@ static void usage(process_rec *process)
apr_pool_create(&ptemp, pconf);
apr_pool_tag(ptemp, "ptemp");
ap_server_root = def_server_root;
- ap_server_conf = ap_read_config(process, ptemp, confname, &ap_conftree);
- if (!ap_server_conf) {
+ if (!ap_read_config(process, ptemp, confname, &ap_conftree)) {
destroy_and_exit_process(process, 1);
}
+ ap_assert(ap_server_conf != NULL);
apr_pool_cleanup_register(pconf, &ap_server_conf,
ap_pool_cleanup_set_null, apr_pool_cleanup_null);
/* sort hooks here to make sure pre_config hooks are sorted properly */