summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2003-01-17 21:23:14 +0000
committerJim McDonough <jmcd@samba.org>2003-01-17 21:23:14 +0000
commit1793c8f1432d152848adce7a0b255b6f431bbc31 (patch)
treee9f6494d6559783f24be32dc9599a7ec99647c49
parent9eb368e068076f65083916573cf832988e216b59 (diff)
downloadsamba-1793c8f1432d152848adce7a0b255b6f431bbc31.tar.gz
samba-1793c8f1432d152848adce7a0b255b6f431bbc31.tar.bz2
samba-1793c8f1432d152848adce7a0b255b6f431bbc31.zip
dlsym() can return NULL validly, so we can't use that as the error test.
dlerror() is the correct way to test. (This used to be commit 41b1be15bac271116a7096e511cc029685013e1f)
-rw-r--r--source3/lib/module.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/lib/module.c b/source3/lib/module.c
index 5ad6485806..6febe8a9f1 100644
--- a/source3/lib/module.c
+++ b/source3/lib/module.c
@@ -27,6 +27,7 @@ NTSTATUS smb_load_module(const char *module_name)
void *handle;
init_module_function *init;
NTSTATUS nt_status;
+ const char *error;
/* Always try to use LAZY symbol resolving; if the plugin has
* backwards compatibility, there might be symbols in the
@@ -41,8 +42,11 @@ NTSTATUS smb_load_module(const char *module_name)
init = sys_dlsym(handle, "init_module");
- if(!init) {
- DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", module_name, sys_dlerror()));
+ /* we must check sys_dlerror() to determine if it worked, because
+ sys_dlsym() can validly return NULL */
+ error = sys_dlerror();
+ if (error) {
+ DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", module_name, error));
return NT_STATUS_UNSUCCESSFUL;
}