You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2023/03/14 15:48:41 UTC
svn commit: r1908393 - in /httpd/httpd/trunk/server: config.c main.c
Author: ylavic
Date: Tue Mar 14 15:48:41 2023
New Revision: 1908393
URL: http://svn.apache.org/viewvc?rev=1908393&view=rev
Log:
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.
Modified:
httpd/httpd/trunk/server/config.c
httpd/httpd/trunk/server/main.c
Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1908393&r1=1908392&r2=1908393&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Tue Mar 14 15:48:41 2023
@@ -2308,6 +2308,9 @@ AP_DECLARE(server_rec*) ap_read_config(p
if (s == NULL) {
return s;
}
+ if (ap_server_conf == NULL) {
+ ap_server_conf = s;
+ }
init_config_globals(p);
Modified: httpd/httpd/trunk/server/main.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/main.c?rev=1908393&r1=1908392&r2=1908393&view=diff
==============================================================================
--- httpd/httpd/trunk/server/main.c (original)
+++ httpd/httpd/trunk/server/main.c Tue Mar 14 15:48:41 2023
@@ -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 */