httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r912666 - in /httpd/httpd/trunk: CHANGES include/util_mutex.h server/core.c server/util_mutex.c
Date Mon, 22 Feb 2010 17:16:29 GMT
Author: trawick
Date: Mon Feb 22 17:16:29 2010
New Revision: 912666

URL: http://svn.apache.org/viewvc?rev=912666&view=rev
Log:
Fix startup segfault when the Mutex directive is used but no loaded 
modules use httpd mutexes.

Add an init call from core's pre-config hook to ensure init is
performed before the config is parsed.

PR: 48787

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/include/util_mutex.h
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/util_mutex.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=912666&r1=912665&r2=912666&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Feb 22 17:16:29 2010
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.7
 
+  *) Fix startup segfault when the Mutex directive is used but no loaded 
+     modules use httpd mutexes.  PR 48787.  [Jeff Trawick]
+
   *) Proxy: get the headers right in a HEAD request with
      ProxyErrorOverride, by checking for an overridden error
      before not after going into a catch-all code path.

Modified: httpd/httpd/trunk/include/util_mutex.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/util_mutex.h?rev=912666&r1=912665&r2=912666&view=diff
==============================================================================
--- httpd/httpd/trunk/include/util_mutex.h (original)
+++ httpd/httpd/trunk/include/util_mutex.h Mon Feb 22 17:16:29 2010
@@ -103,6 +103,9 @@
 AP_DECLARE_NONSTD(const char *) ap_set_mutex(cmd_parms *cmd, void *dummy,
                                              const char *arg);
 
+/* private function to initialize Mutex infrastructure */
+AP_DECLARE_NONSTD(void) ap_mutex_init(apr_pool_t *p);
+
 /**
  * option flags for ap_mutex_register(), ap_global_mutex_create(), and
  * ap_proc_mutex_create()

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=912666&r1=912665&r2=912666&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Mon Feb 22 17:16:29 2010
@@ -3714,6 +3714,13 @@
     sys_privileges += inc;
     return sys_privileges;
 }
+
+static int core_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
+{
+    ap_mutex_init(pconf);
+    return APR_SUCCESS;
+}
+
 static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec
*s)
 {
     ap__logio_add_bytes_out = APR_RETRIEVE_OPTIONAL_FN(ap_logio_add_bytes_out);
@@ -3932,6 +3939,7 @@
     ap_hook_pre_connection(core_pre_connection, NULL, NULL,
                            APR_HOOK_REALLY_LAST);
 
+    ap_hook_pre_config(core_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
     ap_hook_post_config(core_post_config,NULL,NULL,APR_HOOK_REALLY_FIRST);
     ap_hook_translate_name(ap_core_translate,NULL,NULL,APR_HOOK_REALLY_LAST);
     ap_hook_map_to_storage(core_map_to_storage,NULL,NULL,APR_HOOK_REALLY_LAST);

Modified: httpd/httpd/trunk/server/util_mutex.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_mutex.c?rev=912666&r1=912665&r2=912666&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_mutex.c (original)
+++ httpd/httpd/trunk/server/util_mutex.c Mon Feb 22 17:16:29 2010
@@ -143,7 +143,7 @@
     return APR_SUCCESS;
 }
 
-static void mx_hash_init(apr_pool_t *p)
+AP_DECLARE_NONSTD(void) ap_mutex_init(apr_pool_t *p)
 {
     mutex_cfg_t *def;
 
@@ -266,7 +266,7 @@
         return APR_EINVAL;
     }
 
-    mx_hash_init(pconf);
+    ap_mutex_init(pconf); /* in case this mod's pre-config ran before core's */
 
     mxcfg->options = options;
     if (options & AP_MUTEX_DEFAULT_NONE) {



Mime
View raw message