[Pcsclite-cvs-commit] PCSC/src dyn_win32.c,1.7,1.8

rousseau@quantz.debian.org rousseau@quantz.debian.org
Tue, 18 Nov 2003 16:57:22 +0100


Update of /cvsroot/pcsclite/PCSC/src
In directory quantz:/tmp/cvs-serv19801

Modified Files:
	dyn_win32.c 
Log Message:
revert test of return value from FreeLibrary. Thanks to Peter Williams
for the patch.
http://archives.neohapsis.com/archives/dev/muscle/2003-q4/0136.html


Index: dyn_win32.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/dyn_win32.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dyn_win32.c	18 Oct 2003 17:19:36 -0000	1.7
+++ dyn_win32.c	18 Nov 2003 15:57:20 -0000	1.8
@@ -20,7 +20,7 @@
 
 int DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
 {
-	*pvLHandle = 0;
+	*pvLHandle = NULL;
 	*pvLHandle = LoadLibrary(pcLibrary);
 
 	if (*pvLHandle == NULL)
@@ -39,9 +39,11 @@
 	int ret;
 
 	ret = FreeLibrary(*pvLHandle);
-	*pvLHandle = 0;
+	*pvLHandle = NULL;
 
-	if (ret)
+	/* If the function fails, the return value is zero. To get extended error
+	 * information, call GetLastError. */
+	if (ret == 0)
 	{
 #if 0
 		DebugLogB("DYN_CloseLibrary: dlerror() reports %s", dlerror());
@@ -61,11 +63,11 @@
 	 * Zero out everything 
 	 */
 	rv = 0;
-	pcFunctionName = 0;
+	pcFunctionName = NULL;
 
 	pcFunctionName = pcFunction;
 
-	*pvFHandle = 0;
+	*pvFHandle = NULL;
 	*pvFHandle = GetProcAddress(pvLHandle, pcFunctionName);
 
 	if (*pvFHandle == NULL)
@@ -82,3 +84,4 @@
 }
 
 #endif	/* WIN32 */
+