summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2010-11-10 19:03:32 +0100
committerStefan Fritsch <sf@apache.org>2010-11-10 19:03:32 +0100
commitf1527a397de3c2e4a79ae0de9fd5bea705dc21da (patch)
tree6aa9f6a69e72a34bf78e2bc329aacdde006819c3 /server
parentSupress generation of unused yy_top_state function, to avoid a compiler (diff)
downloadapache2-f1527a397de3c2e4a79ae0de9fd5bea705dc21da.tar.xz
apache2-f1527a397de3c2e4a79ae0de9fd5bea705dc21da.zip
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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1033619 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/core.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/core.c b/server/core.c
index cf0d6c6750..83d75bfd3c 100644
--- a/server/core.c
+++ b/server/core.c
@@ -104,6 +104,8 @@ AP_DECLARE_DATA int ap_document_root_check = 1;
/* 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_parms *cmd, void *dummy,
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 *pconf, apr_pool_t *plog, apr_pool_t *ptem
{
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;
}