From 2617b1c54018599ef11cbcf09425d469e185bcd1 Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Fri, 20 Apr 2001 17:59:05 +0000 Subject: [PATCH] Fix seg fault at start-up introduced by Ryan's change to enabl modules to specify their own logging tags. mod_log_config registers an optional function, ap_register_log_handler(). ap_register_log_handler() was being called by http_core before the directive hash table was created. This patch creates the directive hash table before ap_register_log_handler() is registered as an optional function. Submitted by: [jean-frederic clere ] Reviewed by: Jeff Trawick, Bill Stoddard git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88904 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 8 ++++++++ modules/loggers/mod_log_config.c | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ba886eaf9f..6f780d4b35 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,12 @@ Changes with Apache 2.0.18-dev + *) Fix seg fault at start-up introduced by Ryan's change to enable + modules to specify their own logging tags. mod_log_config + registers an optional function, ap_register_log_handler(). + ap_register_log_handler() was being called by http_core before + the directive hash table was created. This patch creates the + directive hash table before ap_register_log_handler() is + registered as an optional function. + [jean-frederic clere ] *) Add ap_set_int_slot() function [John K. Sterling ] diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index 820da86412..13eb18b994 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -1155,7 +1155,6 @@ static void log_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) { static APR_OPTIONAL_FN_TYPE(ap_register_log_handler) *log_pfn_register; - log_hash = apr_hash_make(p); log_pfn_register = APR_RETRIEVE_OPTIONAL_FN(ap_register_log_handler); if (log_pfn_register) { @@ -1195,6 +1194,13 @@ static void register_hooks(apr_pool_t *p) ap_hook_open_logs(init_config_log,NULL,NULL,APR_HOOK_MIDDLE); ap_hook_log_transaction(multi_log_transaction,NULL,NULL,APR_HOOK_MIDDLE); + /* Init log_hash before we register the optional function. It is + * possible for the optional function, ap_register_log_handler, + * to be called before any other mod_log_config hooks are called. + * As a policy, we should init everything required by an optional function + * before calling APR_REGISTER_OPTIONAL_FN. + */ + log_hash = apr_hash_make(p); APR_REGISTER_OPTIONAL_FN(ap_register_log_handler); } -- 2.50.1