diff options
author | Werner Koch <[email protected]> | 2011-12-12 20:02:54 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2012-06-08 03:39:07 +0000 |
commit | fae87058eac21b41e6ec0ad6dca1f4b4f806ab73 (patch) | |
tree | de320348ed533958171a776da14db8a157512945 | |
parent | Fix detection of card removal and insertion. (diff) | |
download | gnupg-fae87058eac21b41e6ec0ad6dca1f4b4f806ab73.tar.gz gnupg-fae87058eac21b41e6ec0ad6dca1f4b4f806ab73.zip |
scd: Retry command SERIALNO for an inactive card.
* scd/command.c (cmd_serialno): Retry once for an inactive card.
-rw-r--r-- | scd/command.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scd/command.c b/scd/command.c index 0a1f7856d..ccb25f1f9 100644 --- a/scd/command.c +++ b/scd/command.c @@ -518,8 +518,10 @@ cmd_serialno (assuan_context_t ctx, char *line) char *serial_and_stamp; char *serial; time_t stamp; + int retries = 0; /* Clear the remove flag so that the open_card is able to reread it. */ + retry: if (!reader_disabled && ctrl->server_local->card_removed) { if ( IS_LOCKED (ctrl) ) @@ -528,7 +530,12 @@ cmd_serialno (assuan_context_t ctx, char *line) } if ((rc = open_card (ctrl, *line? line:NULL))) - return rc; + { + /* In case of an inactive card, retry once. */ + if (gpg_err_code (rc) == GPG_ERR_CARD_RESET && retries++ < 1) + goto retry; + return rc; + } rc = app_get_serial_and_stamp (ctrl->app_ctx, &serial, &stamp); if (rc) |