Author: jelmer
Date: 2005-10-28 22:32:22 +0000 (Fri, 28 Oct 2005)
New Revision: 11385

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11385

Log:
Fix issues in module.c. Calling function should pass in path 
to directory rather then subsystem name now.

Modified:
   branches/SAMBA_4_0/source/lib/basic.mk
   branches/SAMBA_4_0/source/lib/module.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/basic.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/basic.mk      2005-10-28 22:22:30 UTC (rev 
11384)
+++ branches/SAMBA_4_0/source/lib/basic.mk      2005-10-28 22:32:22 UTC (rev 
11385)
@@ -59,9 +59,6 @@
 OBJ_FILES = \
                gencache.o \
 
-[SUBSYSTEM::MODULE]
-OBJ_FILES = module.o
-
 ##############################
 # Start SUBSYSTEM LIBBASIC
 [SUBSYSTEM::LIBBASIC]
@@ -89,7 +86,8 @@
                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

Modified: branches/SAMBA_4_0/source/lib/module.c
===================================================================
--- branches/SAMBA_4_0/source/lib/module.c      2005-10-28 22:22:30 UTC (rev 
11384)
+++ branches/SAMBA_4_0/source/lib/module.c      2005-10-28 22:32:22 UTC (rev 
11385)
@@ -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 @@
 
        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 @@
        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 @@
                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);

Reply via email to