pcsc: correctly handle timeout situation when refreshing reader state.
The code that treated a timeout as success was never reached, because the surrounding if eliminated the possibility of entering the block when the return code from SCardGetStatusChange was SCARD_E_TIMEOUT. Issue found by Coverity Scan.
This commit is contained in:
parent
1f870b0c07
commit
46e0c49d7b
|
@ -286,8 +286,9 @@ static int refresh_attributes(sc_reader_t *reader)
|
||||||
|
|
||||||
rv = priv->gpriv->SCardGetStatusChange(priv->gpriv->pcsc_ctx, 0, &priv->reader_state, 1);
|
rv = priv->gpriv->SCardGetStatusChange(priv->gpriv->pcsc_ctx, 0, &priv->reader_state, 1);
|
||||||
|
|
||||||
if (rv != SCARD_S_SUCCESS && rv != (LONG)SCARD_E_TIMEOUT) {
|
if (rv != SCARD_S_SUCCESS) {
|
||||||
if (rv == (LONG)SCARD_E_TIMEOUT) {
|
if (rv == (LONG)SCARD_E_TIMEOUT) {
|
||||||
|
/* Timeout, no change from previous recorded state. Make sure that changed flag is not set. */
|
||||||
reader->flags &= ~SC_READER_CARD_CHANGED;
|
reader->flags &= ~SC_READER_CARD_CHANGED;
|
||||||
SC_FUNC_RETURN(reader->ctx, SC_LOG_DEBUG_VERBOSE, SC_SUCCESS);
|
SC_FUNC_RETURN(reader->ctx, SC_LOG_DEBUG_VERBOSE, SC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue