[Pcsclite-git-commit] [PCSC] 01/02: fix SCardCancel() that was broken in version 1.8.21

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu Jun 15 15:44:26 UTC 2017


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository PCSC.

commit 7a3738d2f8e48c669b0e3f485cb9dcabeffc941a
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Thu Jun 15 14:45:48 2017 +0200

    fix SCardCancel() that was broken in version 1.8.21
    
    Changes in 9a21c82330fc4b73ac00faf2c5cf948da5f8ab07 broke
    SCardCancel().
    The problem was that SCardCancel() was blocked until
    SCardGetStatusChange() had finished. This is stupid because
    SCardCancel() is supposed to cancel SCardGetStatusChange().
    
    Thanks to Ran Benita for the bug report
    "[Pcsclite-muscle] A recent change causes SCardCancel() to block?"
    http://lists.alioth.debian.org/pipermail/pcsclite-muscle/2017-June/000921.html
---
 src/winscard_clnt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/winscard_clnt.c b/src/winscard_clnt.c
index 9080905..4611e53 100644
--- a/src/winscard_clnt.c
+++ b/src/winscard_clnt.c
@@ -3118,15 +3118,17 @@ LONG SCardCancel(SCARDCONTEXT hContext)
 	/*
 	 * Make sure this context has been opened
 	 */
-	currentContextMap = SCardGetAndLockContext(hContext);
+	(void)SCardLockThread();
+	currentContextMap = SCardGetContextTH(hContext);
+
 	if (NULL == currentContextMap)
 	{
+		(void)SCardUnlockThread();
 		rv = SCARD_E_INVALID_HANDLE;
 		goto error;
 	}
-
 	cancellable = currentContextMap->cancellable;
-	(void)pthread_mutex_unlock(&currentContextMap->mMutex);
+	(void)SCardUnlockThread();
 
 	if (! cancellable)
 	{

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git



More information about the Pcsclite-cvs-commit mailing list