Skip to content

Commit

Permalink
IFDPowerICC(): check the value returned by IFDStatusICC()
Browse files Browse the repository at this point in the history
The reader may be gone at this step.
See https://archives.neohapsis.com/archives/dev/muscle/2012-q2/0041.html


git-svn-id: svn:https://anonscm.debian.org/svn/pcsclite/trunk/PCSC@6312 0ce88b0d-b2fd-0310-8134-9614164e65ea
  • Loading branch information
LudovicRousseau committed May 28, 2012
1 parent 697f8d1 commit 559bc79
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ifdwrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,14 @@ LONG IFDPowerICC(READER_CONTEXT * rContext, DWORD dwAction,
/*
* Check that the card is inserted first
*/
(void)IFDStatusICC(rContext, &dwStatus);
rv = IFDStatusICC(rContext, &dwStatus);
if (rv != IFD_SUCCESS)
{
if (rv == IFD_NO_SUCH_DEVICE)
return SCARD_E_READER_UNAVAILABLE;

return SCARD_E_NOT_TRANSACTED;
}

if (dwStatus & SCARD_ABSENT)
return SCARD_W_REMOVED_CARD;
Expand Down

0 comments on commit 559bc79

Please sign in to comment.