You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2002/04/19 20:31:20 UTC
cvs commit: httpd-2.0/modules/mappers mod_so.c
trawick 02/04/19 11:31:20
Modified: . CHANGES
modules/mappers mod_so.c
Log:
Trigger an error when a LoadModule directive attempts to
load a module which is built-in. This is a common error when
switching from a DSO build to a static build.
Revision Changes Path
1.717 +4 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.716
retrieving revision 1.717
diff -u -r1.716 -r1.717
--- CHANGES 19 Apr 2002 14:04:29 -0000 1.716
+++ CHANGES 19 Apr 2002 18:31:19 -0000 1.717
@@ -1,5 +1,9 @@
Changes with Apache 2.0.36
+ *) Trigger an error when a LoadModule directive attempts to
+ load a module which is built-in. This is a common error when
+ switching from a DSO build to a static build. [Jeff Trawick]
+
*) Change instdso.sh to use libtool --install everywhere and then
clean up some stray files and symlinks that libtool leaves around
on some platforms. This gets subversion building properly since
1.49 +40 -0 httpd-2.0/modules/mappers/mod_so.c
Index: mod_so.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- mod_so.c 16 Mar 2002 18:26:57 -0000 1.48
+++ mod_so.c 19 Apr 2002 18:31:20 -0000 1.49
@@ -220,6 +220,7 @@
/*
* check for already existing module
* If it already exists, we have nothing to do
+ * Check both dynamically-loaded modules and statically-linked modules.
*/
sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config,
&so_module);
@@ -233,6 +234,45 @@
return NULL;
}
}
+
+ for (i = 0; ap_preloaded_modules[i]; i++) {
+ const char *preload_name;
+ apr_size_t preload_len;
+ apr_size_t thismod_len;
+
+ modp = ap_preloaded_modules[i];
+
+ /* make sure we're comparing apples with apples
+ * make sure name of preloaded module is mod_FOO.c
+ * make sure name of structure being loaded is FOO_module
+ */
+
+ if (memcmp(modp->name, "mod_", 4)) {
+ continue;
+ }
+
+ preload_name = modp->name + strlen("mod_");
+ preload_len = strlen(preload_name) - 2;
+
+ if (strlen(modname) <= strlen("_module")) {
+ continue;
+ }
+ thismod_len = strlen(modname) - strlen("_module");
+ if (strcmp(modname + thismod_len, "_module")) {
+ continue;
+ }
+
+ if (thismod_len != preload_len) {
+ continue;
+ }
+
+ if (!memcmp(modname, preload_name, preload_len)) {
+ return apr_pstrcat(cmd->pool, "module ", modname,
+ " is built-in and can't be loaded",
+ NULL);
+ }
+ }
+
modi = apr_array_push(sconf->loaded_modules);
modi->name = modname;