[PATCH] Switch to lt_dlopenadvise() to get RTLD_GLOBAL set.

Niko Tyni ntyni at debian.org
Sun Nov 29 20:10:30 UTC 2009


Proof of concept for fixing http://bugs.debian.org/416266
---
 src/main/modules.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/main/modules.c b/src/main/modules.c
index ea1c256..7a93b0e 100644
--- a/src/main/modules.c
+++ b/src/main/modules.c
@@ -391,6 +391,21 @@ int detach_modules(void)
 }
 
 
+static lt_dlhandle my_dlopenextglobal (const char *filename)
+{
+	lt_dlhandle handle = 0;
+	lt_dladvise advise;
+
+	if (!lt_dladvise_init (&advise) && !lt_dladvise_ext (&advise)
+	    && !lt_dladvise_global (&advise))
+		handle = lt_dlopenadvise (filename, advise);
+
+	lt_dladvise_destroy (&advise);
+
+	return handle;
+}
+
+
 /*
  *	Find a module on disk or in memory, and link to it.
  */
@@ -411,7 +426,7 @@ static module_entry_t *linkto_module(const char *module_name,
 	/*
 	 *	Keep the handle around so we can dlclose() it.
 	 */
-	handle = lt_dlopenext(module_name);
+	handle = my_dlopenextglobal(module_name);
 	if (handle == NULL) {
 		cf_log_err(cf_sectiontoitem(cs),
 			   "Failed to link to module '%s': %s\n",
-- 
1.6.5.2


--gKMricLos+KVdGMg--





More information about the Pkg-openldap-devel mailing list