From 773f0ecf5ab07975b17f10448fb06af06905e8b7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Oct 2005 22:32:22 +0000 Subject: r11385: Fix issues in module.c. Calling function should pass in path to directory rather then subsystem name now. (This used to be commit 2a868ab3b57f64a27416c7a24c8d1ae112fc0c53) --- source4/lib/basic.mk | 6 ++---- source4/lib/module.c | 16 ++++------------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 06470a1079..383892eb9c 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -59,9 +59,6 @@ INIT_OBJ_FILES = \ OBJ_FILES = \ gencache.o \ -[SUBSYSTEM::MODULE] -OBJ_FILES = module.o - ############################## # Start SUBSYSTEM LIBBASIC [SUBSYSTEM::LIBBASIC] @@ -89,7 +86,8 @@ ADD_OBJ_FILES = \ mutex.o \ idtree.o \ db_wrap.o \ - gendb.o + gendb.o \ + module.o REQUIRED_SUBSYSTEMS = \ LIBLDB CHARSET LIBREPLACE LIBNETIF LIBCRYPTO EXT_LIB_DL LIBTALLOC \ SOCKET_WRAPPER CONFIG diff --git a/source4/lib/module.c b/source4/lib/module.c index b46d2b317c..2eb9f6e61e 100644 --- a/source4/lib/module.c +++ b/source4/lib/module.c @@ -19,7 +19,6 @@ */ #include "includes.h" -#include "dynconfig.h" #include "system/dir.h" static BOOL load_module(TALLOC_CTX *mem_ctx, const char *dir, const char *name) @@ -31,7 +30,7 @@ static BOOL load_module(TALLOC_CTX *mem_ctx, const char *dir, const char *name) path = talloc_asprintf(mem_ctx, "%s/%s", dir, name); - handle = dlopen(path, 0); + handle = dlopen(path, RTLD_NOW); if (handle == NULL) { DEBUG(0, ("Unable to open %s: %s\n", path, dlerror())); return False; @@ -56,23 +55,16 @@ static BOOL load_module(TALLOC_CTX *mem_ctx, const char *dir, const char *name) return ret; } -BOOL load_modules(const char *subsystem) +BOOL load_modules(const char *path) { DIR *dir; struct dirent *entry; - char *dir_path; BOOL ret; TALLOC_CTX *mem_ctx; mem_ctx = talloc_init(NULL); - dir_path = talloc_asprintf(mem_ctx, "%s/%s", dyn_LIBDIR, subsystem); - if (!dir_path) { - talloc_free(mem_ctx); - return False; - } - - dir = opendir(subsystem); + dir = opendir(path); if (dir == NULL) { talloc_free(mem_ctx); return False; @@ -82,7 +74,7 @@ BOOL load_modules(const char *subsystem) if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) continue; - ret &= load_module(mem_ctx, dir_path, entry->d_name); + ret &= load_module(mem_ctx, path, entry->d_name); } closedir(dir); -- cgit