r11385: Fix issues in module.c. Calling function should pass in path
authorJelmer Vernooij <jelmer@samba.org>
Fri, 28 Oct 2005 22:32:22 +0000 (22:32 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:45:29 +0000 (13:45 -0500)
to directory rather then subsystem name now.

source/lib/basic.mk
source/lib/module.c

index 06470a10794466b5df482b1136dbda847d0eea22..383892eb9c6291f335e345db961f7a5db2f5322d 100644 (file)
@@ -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
index b46d2b317c94bcd9cd69d05b68838c4f82f2e03a..2eb9f6e61e42145fbcbd1caf47217c1719fd1577 100644 (file)
@@ -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);