diff options
author | Tim Potter <tpot@samba.org> | 2003-09-04 02:02:26 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2003-09-04 02:02:26 +0000 |
commit | fb638ddf99897fe846250d07d40e60fbe2a688c9 (patch) | |
tree | a3926ce5632a7b50fdc09f385d04e1ef46cbf07d /source3/lib/module.c | |
parent | 245fbf7efbc42530c81d5aac66681bb892c97557 (diff) | |
download | samba-fb638ddf99897fe846250d07d40e60fbe2a688c9.tar.gz |
Quieten level 0 debug when probing for modules. We shouldn't display so loud
an error when a smb_probe_module() fails. Also tidy up debugs a bit.
Bug 375.
(This used to be commit 24a1720472f1340778dea76a88770520dca26f12)
Diffstat (limited to 'source3/lib/module.c')
-rw-r--r-- | source3/lib/module.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/source3/lib/module.c b/source3/lib/module.c index d860cba8195..e2c6f6dcf51 100644 --- a/source3/lib/module.c +++ b/source3/lib/module.c @@ -23,7 +23,11 @@ #include "includes.h" #ifdef HAVE_DLOPEN -NTSTATUS smb_load_module(const char *module_name) + +/* Load a dynamic module. Only log a level 0 error if we are not checking + for the existence of a module (probling). */ + +static NTSTATUS do_smb_load_module(const char *module_name, BOOL is_probe) { void *handle; init_module_function *init; @@ -37,7 +41,10 @@ NTSTATUS smb_load_module(const char *module_name) handle = sys_dlopen(module_name, RTLD_LAZY); if(!handle) { - DEBUG(0, ("Error loading module '%s': %s\n", module_name, sys_dlerror())); + int level = is_probe ? 2 : 0; + DEBUG(level, ("Error loading module '%s': %s\n", module_name, + sys_dlerror())); + return NT_STATUS_UNSUCCESSFUL; } @@ -47,7 +54,8 @@ NTSTATUS smb_load_module(const char *module_name) 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)); + DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", + module_name, error)); return NT_STATUS_UNSUCCESSFUL; } @@ -58,6 +66,11 @@ NTSTATUS smb_load_module(const char *module_name) return status; } +NTSTATUS smb_load_module(const char *module_name) +{ + return do_smb_load_module(module_name, False); +} + /* Load all modules in list and return number of * modules that has been successfully loaded */ int smb_load_modules(const char **modules) @@ -85,8 +98,11 @@ NTSTATUS smb_probe_module(const char *subsystem, const char *module) /* if we make any 'samba multibyte string' calls here, we break for loading string modules */ + + DEBUG(5, ("Probing module '%s'\n", module)); + if (module[0] == '/') - return smb_load_module(module); + return do_smb_load_module(module, True); pstrcpy(full_path, lib_path(subsystem)); pstrcat(full_path, "/"); @@ -94,9 +110,9 @@ NTSTATUS smb_probe_module(const char *subsystem, const char *module) pstrcat(full_path, "."); pstrcat(full_path, shlib_ext()); - DEBUG(5, ("Probing module %s: Trying to load from %s\n", module, full_path)); + DEBUG(5, ("Probing module '%s': Trying to load from %s\n", module, full_path)); - return smb_load_module(full_path); + return do_smb_load_module(full_path, True); } #else /* HAVE_DLOPEN */ |