httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1033619 - /httpd/httpd/trunk/server/core.c
Date Wed, 10 Nov 2010 18:03:32 GMT
Author: sf
Date: Wed Nov 10 18:03:32 2010
New Revision: 1033619

URL: http://svn.apache.org/viewvc?rev=1033619&view=rev
Log:
When restarting, reset ap_server_config_defines to what was set on the command
line. This makes the result more predictable for the user and resolves some
string lifetime issues in the implementation of set_define/unset_define.

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

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1033619&r1=1033618&r2=1033619&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Nov 10 18:03:32 2010
@@ -104,6 +104,8 @@ AP_DECLARE_DATA int ap_document_root_che
 /* magic pointer for ErrorDocument xxx "default" */
 static char errordocument_default;
 
+static apr_array_header_t *saved_server_config_defines = NULL;
+
 static void *create_core_dir_config(apr_pool_t *a, char *dir)
 {
     core_dir_config *conf;
@@ -1054,6 +1056,12 @@ static const char *set_access_name(cmd_p
     return NULL;
 }
 
+static int reset_config_defines(void *dummy)
+{
+    ap_server_config_defines = saved_server_config_defines;
+    return OK;
+}
+
 
 static const char *set_define(cmd_parms *cmd, void *dummy,
                               const char *optarg)
@@ -3941,6 +3949,16 @@ static int core_pre_config(apr_pool_t *p
 {
     ap_mutex_init(pconf);
 
+    /*
+     * Make sure we revert the effects of Define/UnDefine when restarting.
+     * We cannot use apr_array_copy_hdr because it does not protect from the
+     * way unset_define removes entries.
+     */
+    saved_server_config_defines = ap_server_config_defines;
+    ap_server_config_defines = apr_array_copy(pconf, ap_server_config_defines);
+    apr_pool_cleanup_register(pconf, NULL, reset_config_defines,
+                              apr_pool_cleanup_null);
+
     return APR_SUCCESS;
 }
 



Mime
View raw message