[Pcsclite-cvs-commit] r5574 - /trunk/PCSC/src/winscard.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Feb 1 16:02:37 UTC 2011


Author: rousseau
Date: Tue Feb  1 16:02:27 2011
New Revision: 5574

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5574
Log:
SCardDisconnect(): RFUnlockAllSharing() may fail with
SCARD_E_SHARING_VIOLATION if a transaction is on going on another card
context and dwDisposition == SCARD_LEAVE_CARD. We should not stop and
continue disconnecting the card.

Fixes Alioth bug [#312960] SCardDisconnect when other context has transaction

Modified:
    trunk/PCSC/src/winscard.c

Modified: trunk/PCSC/src/winscard.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard.c?rev=5574&op=diff
==============================================================================
--- trunk/PCSC/src/winscard.c (original)
+++ trunk/PCSC/src/winscard.c Tue Feb  1 16:02:27 2011
@@ -803,11 +803,25 @@
 	}
 
 	/*
-	 * Unlock any blocks on this context
+	 * Try to unlock any blocks on this context
+	 *
+	 * This may fail with SCARD_E_SHARING_VIOLATION if a transaction is
+	 * on going on another card context and dwDisposition == SCARD_LEAVE_CARD.
+	 * We should not stop.
 	 */
 	rv = RFUnlockAllSharing(hCard, rContext);
 	if (rv != SCARD_S_SUCCESS)
-		return rv;
+	{
+		if (rv != SCARD_E_SHARING_VIOLATION)
+		{
+			return rv;
+		}
+		else
+		{
+			if (SCARD_LEAVE_CARD != dwDisposition)
+				return rv;
+		}
+	}
 
 	Log2(PCSC_LOG_DEBUG, "Active Contexts: %d", rContext->contexts);
 	Log2(PCSC_LOG_DEBUG, "dwDisposition: %d", dwDisposition);




More information about the Pcsclite-cvs-commit mailing list