httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Re: Something I learned, today
Date Sat, 10 Nov 2001 07:21:00 GMT
William A. Rowe, Jr. wrote:

>If one adds a module multiple times, (in this case, the silly user just
>commented out the ClearModuleList) there is no warning whatsoever, yet
>it causes (obviously) no end of chaos and unpredictable failures.  This
>especially impacts upgraders who foolishly copy configs from one install
>to another.
>
>If someone wants a little hack to write, take the LoadModule (and on 1.3,
>AddModule) and actually _test_ to see if that module is yet loaded :)
>

It looks like the check to prevent multiple loading is already there,
at least in 2.0.  Here's a warning message to go along with it, though:

Index: modules/mappers/mod_so.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_so.c,v
retrieving revision 1.44
diff -u -r1.44 mod_so.c
--- modules/mappers/mod_so.c    2001/10/16 19:04:02    1.44
+++ modules/mappers/mod_so.c    2001/11/10 07:10:18
@@ -221,8 +221,12 @@
     modie = (moduleinfo *)sconf->loaded_modules->elts;
     for (i = 0; i < sconf->loaded_modules->nelts; i++) {
         modi = &modie[i];
-        if (modi->name != NULL && strcmp(modi->name, modname) == 0)
+        if (modi->name != NULL && strcmp(modi->name, modname) == 0) {
+            ap_log_perror(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0,
+                          cmd->pool, "module %s is already loaded, 
skipping",
+                          modname);
             return NULL;
+        }
     }
     modi = apr_array_push(sconf->loaded_modules);
     modi->name = modname;



Mime
View raw message