From 970c6876c54e65bcdce11fea461188a15ac25802 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Fri, 25 Aug 2006 16:14:00 +0000 Subject: [PATCH] instead of reverting this supposedly 'stupid' change, let's try to get it working properly also eliminate a warning from dlopen() because some flags were missing on the second dlopen() call git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41087 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/loader.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main/loader.c b/main/loader.c index 681f5ed340..4ece4ae6b6 100644 --- a/main/loader.c +++ b/main/loader.c @@ -387,6 +387,14 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned on the already-opened library to what we want... if not, we have to close it and start over */ +#if HAVE_RTLD_NOLOAD + if (!dlopen(fn, RTLD_NOLOAD | (wants_global ? RTLD_LAZY | RTLD_GLOBAL : RTLD_NOW | RTLD_LOCAL))) { + ast_log(LOG_WARNING, "%s\n", dlerror()); + while (!dlclose(lib)); + free(resource_being_loaded); + return NULL; + } +#else while (!dlclose(lib)); resource_being_loaded = NULL; @@ -406,6 +414,7 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned /* since the module was successfully opened, and it registered itself the previous time we did that, we're going to assume it worked this time too :) */ +#endif AST_LIST_LAST(&module_list)->lib = lib; resource_being_loaded = NULL;