]> granicus.if.org Git - apache/commitdiff
Fix seg fault at start-up introduced by Ryan's change to enabl
authorBill Stoddard <stoddard@apache.org>
Fri, 20 Apr 2001 17:59:05 +0000 (17:59 +0000)
committerBill Stoddard <stoddard@apache.org>
Fri, 20 Apr 2001 17:59:05 +0000 (17:59 +0000)
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 <jfrederic.clere@fujitsu-siemens.com>]
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
modules/loggers/mod_log_config.c

diff --git a/CHANGES b/CHANGES
index ba886eaf9ff1cadc59440eaaa11be89427175a13..6f780d4b3539f2115e3e9466587b2b878f764481 100644 (file)
--- 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 <jfrederic.clere@fujitsu-siemens.com>]
 
   *) Add ap_set_int_slot() function
      [John K. Sterling <sterling@covalent.net>]
index 820da86412423ea1ea9c883c9da7a109d0135718..13eb18b99448e8997db04feb6b8efc3574e830ee 100644 (file)
@@ -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);
 }