You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2020/12/08 14:27:00 UTC

svn commit: r1884208 - in /httpd/httpd/trunk/server: config.c core.c

Author: jorton
Date: Tue Dec  8 14:27:00 2020
New Revision: 1884208

URL: http://svn.apache.org/viewvc?rev=1884208&view=rev
Log:
Rearrange and clear global core config state allocated out of pconf
from a single cleanup:

* server/core.c (reset_config): Clear ap_runtime_dir here, rather than
  in register_hooks.

Modified:
    httpd/httpd/trunk/server/config.c
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1884208&r1=1884207&r2=1884208&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Tue Dec  8 14:27:00 2020
@@ -59,7 +59,6 @@
 
 AP_DECLARE_DATA const char *ap_server_argv0 = NULL;
 AP_DECLARE_DATA const char *ap_server_root = NULL;
-AP_DECLARE_DATA const char *ap_runtime_dir = NULL;
 AP_DECLARE_DATA server_rec *ap_server_conf = NULL;
 AP_DECLARE_DATA apr_pool_t *ap_pglobal = NULL;
 

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1884208&r1=1884207&r2=1884208&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Tue Dec  8 14:27:00 2020
@@ -127,15 +127,18 @@ AP_DECLARE_DATA int ap_document_root_che
 /* magic pointer for ErrorDocument xxx "default" */
 static char errordocument_default;
 
+/* Global state allocated out of pconf: variables here MUST be
+ * cleared/reset in reset_config(), a pconf cleanup, to avoid the
+ * variable getting reused after the pool is cleared. */
 static apr_array_header_t *saved_server_config_defines = NULL;
 static apr_table_t *server_config_defined_vars = NULL;
+AP_DECLARE_DATA const char *ap_runtime_dir = NULL;
+static const char *core_state_dir;
 
 AP_DECLARE_DATA int ap_main_state = AP_SQ_MS_INITIAL_STARTUP;
 AP_DECLARE_DATA int ap_run_mode = AP_SQ_RM_UNKNOWN;
 AP_DECLARE_DATA int ap_config_generation = 0;
 
-static const char *core_state_dir;
-
 typedef struct {
     apr_ipsubnet_t *subnet;
     struct ap_logconf log;
@@ -1489,6 +1492,7 @@ static apr_status_t reset_config(void *d
     saved_server_config_defines = NULL;
     server_config_defined_vars = NULL;
     core_state_dir = NULL;
+    ap_runtime_dir = NULL;
 
     return APR_SUCCESS;
 }
@@ -5863,7 +5867,6 @@ static int core_upgrade_storage(request_
 
 static void register_hooks(apr_pool_t *p)
 {
-    ap_runtime_dir = NULL;
     errorlog_hash = apr_hash_make(p);
     ap_register_log_hooks(p);
     ap_register_config_hooks(p);