[Pcsclite-cvs-commit] r2833 - /trunk/PCSC/src/winscard_clnt.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Feb 19 13:35:09 UTC 2008


Author: rousseau
Date: Tue Feb 19 13:35:09 2008
New Revision: 2833

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=2833
Log:
SCardReleaseContext(): release the local resource even if the daemon
does not respond

Thanks to Eric Walter for the bug report

Modified:
    trunk/PCSC/src/winscard_clnt.c

Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=2833&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Tue Feb 19 13:35:09 2008
@@ -568,9 +568,6 @@
 
 	PROFILE_START
 
-	if (SCardCheckDaemonAvailability() != SCARD_S_SUCCESS)
-		return SCARD_E_NO_SERVICE;
-
 	/*
 	 * Make sure this context has been opened
 	 */
@@ -578,6 +575,16 @@
 	if (dwContextIndex == -1)
 		return SCARD_E_INVALID_HANDLE;
 
+	/*
+	 * Remove the local context from the stack
+	 */
+	SCardLockThread();
+	SCardRemoveContext(hContext);
+	SCardUnlockThread();
+
+	if (SCardCheckDaemonAvailability() != SCARD_S_SUCCESS)
+		return SCARD_E_NO_SERVICE;
+
 	SYS_MutexLock(psContextMap[dwContextIndex].mMutex);
 
 	scReleaseStruct.hContext = hContext;
@@ -606,13 +613,6 @@
 	}
 
 	SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
-
-	/*
-	 * Remove the local context from the stack
-	 */
-	SCardLockThread();
-	SCardRemoveContext(hContext);
-	SCardUnlockThread();
 
 	PROFILE_END(scReleaseStruct.rv)
 




More information about the Pcsclite-cvs-commit mailing list