]> code.citadel.org Git - citadel.git/commitdiff
Bug fixes/cleanup for HP/UX dynamic modules. Changed binding of modules
authorMichael Hampton <io_error@uncensored.citadel.org>
Sun, 3 Sep 2000 06:38:40 +0000 (06:38 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sun, 3 Sep 2000 06:38:40 +0000 (06:38 +0000)
back to RTLD_LAZY.

citadel/dynloader.c
citadel/hpsux.h

index 459d6d62731e046576483c20cf6df69f7226d40f..585b4ff3d52b78f6b24e48c93ce4026cf82263d8 100644 (file)
@@ -102,8 +102,9 @@ void DLoader_Init(char *pathname)
                        continue;
 
                snprintf(pathbuf, PATH_MAX, "%s/%s", pathname, dptr->d_name);
-#ifdef RTLD_NOW
-               if (!(fcn_handle = dlopen(pathbuf, RTLD_NOW)))
+
+#ifdef RTLD_LAZY
+               if (!(fcn_handle = dlopen(pathbuf, RTLD_LAZY)))
 #else                          /* OpenBSD */
                if (!(fcn_handle = dlopen(pathbuf, DL_LAZY)))
 #endif
index e4ebb5bdd71bf78bb20d79847b4928c6a59ca0de..a12a93a13ac4beedee8b0876c1a332ea4c344243 100644 (file)
@@ -32,7 +32,7 @@ extern int errno;
 
 
 /* local variables */
-static char *dlerrmsg; /* pointer to last error message */
+static int dlerrmsg;   /* Last errno received */
 
 
 /* functions mapped */
@@ -44,7 +44,9 @@ void *dlopen(const char *filename, int flag)
 
        handle = shl_load(filename, flag, 0L);
        if (handle == NULL)
-               dlerrmsg = strerror(errno);
+               dlerrmsg = errno;
+       else
+               dlerrmsg = 0;
        return (void *)handle;
 }
 
@@ -58,22 +60,27 @@ int dlclose(void *handle)
 /* I think this is as thread safe as it's going to get */
 const char *dlerror(void)
 {
-       const char *msg;
+       int msg;
 
        msg = dlerrmsg;
-       dlerrmsg = NULL;
-       return msg;
+       dlerrmsg = 0;
+       if (msg)
+               return strerror(msg);
+       return NULL;
 }
 
 /* dlsym() */
 void *dlsym(void *handle, char *symbol)
 {
-       void *value = NULL;     /* Linux man page says 0 is a valid symbol */
+       void *symaddr = NULL;   /* Linux man page says 0 is a valid symbol */
        /* address.  I don't understand this, of course, but what do I know? */
 
-       if (shl_findsym(handle, symbol, TYPE_UNDEFINED, value) == -1)
-               dlerrmsg = strerror(errno);
-       return value;
+       if (shl_findsym((shl_t *)&handle, symbol, TYPE_PROCEDURE, &symaddr) == -1)
+               dlerrmsg = errno;
+       else {
+               dlerrmsg = 0;
+       }
+       return symaddr;
 }
 
 #endif /* _CITADEL_UX_HPSUX_H */