Re: Crash in unloading in HP-UX while calling dlclose()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Biswatosh wrote:

>Hi Alexei,
>
>One of my folks is getting a crash in dlclose() on
>HP-UX.
>When I see the code for dlopen() and dlclose()
>functions in dlopen.c for HP-UX, I get the following
>doubts.
>
>My doubts are:
>
>1) In function dlopen(), why can't we simply call
>shl_load() and return?
>Why we are defining a shl_t *hp ? And, what we are
>trying to do by typecasting
>hp to dll_handle and returning that? dll_handle is of
>type shl_t whereas hp is of type
>shl_t*(which is therefore a double pointer).
>
>2)The reporter of the crash smells problem in the line
>return shl_unload(h) in dlclose().
>He suggests, it should be rather shl_unload(hp).What
>do you guys think?  But anyway, I am not getting why
>in dlclose(), simply calling shl_unload(h) won't do.
>Any comments? 
>  
>
Looking at the code and HP-UX documentation it seems that you are right 
in both cases.
Can you see if the attached patch works for you?

Index: dlopen.c
===================================================================
RCS file: /cvs/src/sasl/lib/dlopen.c,v
retrieving revision 1.49
diff -u -r1.49 dlopen.c
--- dlopen.c	15 Mar 2005 13:33:30 -0000	1.49
+++ dlopen.c	30 May 2006 11:44:28 -0000
@@ -95,7 +95,7 @@
 #ifndef HAVE_DLFCN_H
 #include <dl.h>
 
-typedef shl_t dll_handle;
+typedef shl_t * dll_handle;
 typedef void * dll_func;
 
 dll_handle
@@ -117,11 +117,18 @@
 }
 
 int
-dlclose(dll_handle h)
+dlclose(dll_handle hp)
 {
-    shl_t hp = *((shl_t *)h);
-    if (hp != NULL) free(hp);
-    return shl_unload(h);
+    shl_t h;
+
+    if (hp != NULL) {
+	h = *((shl_t *)hp);
+	free(hp);
+	return shl_unload(h);
+    } else {
+	/* Return error */
+	return -1;
+    }
 }
 
 dll_func

[Index of Archives]     [Info Cyrus]     [Squirrel Mail]     [Linux Media]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux