[Pcsclite-cvs-commit] r5968 - /trunk/PCSC/src/spy/pcsc-spy.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Sep 27 07:16:38 UTC 2011


Author: rousseau
Date: Tue Sep 27 07:16:37 2011
New Revision: 5968

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5968
Log:
load_lib(): handle dlsym() errors

log an error and return SCARD_F_INTERNAL_ERROR if dlopen() or dlsym()
fails.

Modified:
    trunk/PCSC/src/spy/pcsc-spy.c

Modified: trunk/PCSC/src/spy/pcsc-spy.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/pcsc-spy.c?rev=5968&op=diff
==============================================================================
--- trunk/PCSC/src/spy/pcsc-spy.c (original)
+++ trunk/PCSC/src/spy/pcsc-spy.c Tue Sep 27 07:16:37 2011
@@ -288,11 +288,12 @@
 	handle = dlopen(LIBPCSC, RTLD_LAZY);
 	if (NULL == handle)
 	{
-		spy_line("%s", dlerror());
+		log_line("%s", dlerror());
 		return SCARD_F_INTERNAL_ERROR;
 	}
 
-#define get_symbol(s) spy.s = dlsym(handle, #s)
+#define get_symbol(s) do { spy.s = dlsym(handle, #s); if (NULL == spy.s) { log_line("%s", dlerror()); return SCARD_F_INTERNAL_ERROR; } } while (0)
+
 	get_symbol(SCardEstablishContext);
 	get_symbol(SCardReleaseContext);
 	get_symbol(SCardIsValidContext);
@@ -330,7 +331,9 @@
 		init = 1;
 
 		/* load the real library */
-		load_lib();
+		rv = load_lib();
+		if (rv != SCARD_S_SUCCESS)
+			return rv;
 
 		/* check if we can log */
 		home = getenv("HOME");
@@ -617,3 +620,4 @@
 	Quit();
 	return rv;
 }
+




More information about the Pcsclite-cvs-commit mailing list