]> granicus.if.org Git - apache/commitdiff
core: Abort with sensible error message if no or more than one MPM is
authorStefan Fritsch <sf@apache.org>
Sat, 21 Aug 2010 18:06:41 +0000 (18:06 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 21 Aug 2010 18:06:41 +0000 (18:06 +0000)
loaded.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@987806 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/ap_mmn.h
include/mpm_common.h
server/config.c
server/mpm_common.c

diff --git a/CHANGES b/CHANGES
index 7611792400d18a44628c666c6c228ef280f107f6..54e5890f8eacd8d1c2f0e35eabc97c6fba05e4ae 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.8
 
+  *) core: Abort with sensible error message if no or more than one MPM is
+     loaded. [Stefan Fritsch]
+
   *) mod_proxy: Rename erroronstatus to failonstatus.
      [Daniel Ruggeri <DRuggeri primary.net>]
 
index b97547f16889466cce8c3c132c8e4f01628d583d..40860edd90492f5911ff3f50c568f73e8e2fa5ca 100644 (file)
  * 20100723.1 (2.3.7-dev)  Added ap_proxy_hashfunc() and hash elements to
  *                         proxy worker structs
  * 20100723.2 (2.3.7-dev)  Add ap_request_has_body()
+ * 20100723.3 (2.3.8-dev)  Add ap_check_mpm()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20100723
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 3                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index ebca2b766ff63d7b2b0a051090aded9a904b9426..fc6ee1c09875fa1d5878c8810a3d2341fba7dc7a 100644 (file)
@@ -242,6 +242,12 @@ AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod);
  */
 AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num);
 
+/**
+ * Check that exactly one MPM is loaded
+ * Returns NULL if yes, error string if not.
+ */
+AP_DECLARE(const char *) ap_check_mpm(void);
+
 /*
  * These data members are common to all mpms. Each new mpm
  * should either use the appropriate ap_mpm_set_* function
index b58f096939281ae63755d49edb35438b5ac752ce..ea54280ea46888e84c5a786ee9cd229034dd7592 100644 (file)
@@ -49,6 +49,7 @@
 #include "http_main.h"
 #include "http_vhost.h"
 #include "util_cfgtree.h"
+#include "mpm_common.h"
 
 #define APLOG_UNSET   (APLOG_NO_MODULE - 1)
 APLOG_USE_MODULE(core);
@@ -2242,6 +2243,13 @@ AP_DECLARE(server_rec*) ap_read_config(process_rec *process, apr_pool_t *ptemp,
         return NULL;
     }
 
+    error = ap_check_mpm();
+    if (error) {
+        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, 0, NULL,
+                     "%s: Configuration error: %s", ap_server_argv0, error);
+        return NULL;
+    }
+
     /*
      * We have loaded the dynamic modules. From now on we know exactly how
      * long the config vectors need to be.
index 56bc70c87541d5aa5ac219bd388d69c86d2d5c44..e45a089447d2b18c2f3fa22fed9a0cdc5f130495 100644 (file)
@@ -375,3 +375,13 @@ AP_DECLARE(const char *)ap_show_mpm(void)
 
     return name;
 }
+
+AP_DECLARE(const char *)ap_check_mpm(void)
+{
+    if (!_hooks.link_mpm || _hooks.link_mpm->nelts == 0)
+        return "No MPM loaded.";
+    else if (_hooks.link_mpm->nelts > 1)
+        return "More than one MPM loaded.";
+    else
+        return NULL;
+}