mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
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 41b1be15ba
)
This commit is contained in:
parent
9eb368e068
commit
1793c8f143
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user