[Pcsclite-git-commit] [PCSC] 08/10: SCardConnect(): do not use a local readerState
Ludovic Rousseau
rousseau at moszumanska.debian.org
Fri Aug 5 15:48:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository PCSC.
commit a8358bc84be4c8870cb4955f4e106f4d46740cfd
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Fri Aug 5 16:16:13 2016 +0200
SCardConnect(): do not use a local readerState
We do want to change the value of rContext->readerState->readerState after
the power up, not just the value of the local copy.
I am not sure the code was broken but it will help make the next patch
work.
---
src/winscard.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/winscard.c b/src/winscard.c
index a7e1f46..dbee705 100644
--- a/src/winscard.c
+++ b/src/winscard.c
@@ -234,7 +234,6 @@ LONG SCardConnect(/*@unused@*/ SCARDCONTEXT hContext, LPCSTR szReader,
{
LONG rv;
READER_CONTEXT * rContext = NULL;
- uint32_t readerState;
(void)hContext;
PROFILE_START
@@ -303,11 +302,9 @@ LONG SCardConnect(/*@unused@*/ SCARDCONTEXT hContext, LPCSTR szReader,
* presence of a card or not
*
*******************************************/
- readerState = rContext->readerState->readerState;
-
if (dwShareMode != SCARD_SHARE_DIRECT)
{
- if (!(readerState & SCARD_PRESENT))
+ if (!(rContext->readerState->readerState & SCARD_PRESENT))
{
Log1(PCSC_LOG_DEBUG, "Card Not Inserted");
rv = SCARD_E_NO_SMARTCARD;
@@ -327,7 +324,7 @@ LONG SCardConnect(/*@unused@*/ SCARDCONTEXT hContext, LPCSTR szReader,
if (rv == IFD_SUCCESS)
{
- readerState = SCARD_PRESENT | SCARD_POWERED | SCARD_NEGOTIABLE;
+ rContext->readerState->readerState = SCARD_PRESENT | SCARD_POWERED | SCARD_NEGOTIABLE;
Log1(PCSC_LOG_DEBUG, "power up complete.");
LogXxd(PCSC_LOG_DEBUG, "Card ATR: ",
@@ -339,7 +336,7 @@ LONG SCardConnect(/*@unused@*/ SCARDCONTEXT hContext, LPCSTR szReader,
rv, rv);
}
- if (! (readerState & SCARD_POWERED))
+ if (! (rContext->readerState->readerState & SCARD_POWERED))
{
Log1(PCSC_LOG_ERROR, "Card Not Powered");
(void)pthread_mutex_unlock(&rContext->powerState_lock);
--
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