1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-03 22:48:03 +02:00

scd: Fix an action after card removal.

* scd/command.c (update_card_removed): Call apdu_close_reader here.

--

This is update of the commit 8fe8105576
It is better apdu_close_reader is called in update_card_removed.

The commit 1598a44764 introduced a
regression, it doesn't close the reader after removal of the card, while
the code before the commit call apdu_close_reader in do_reset.
So, this fix.

GnuPG-bug-id: 2449
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2016-09-03 15:27:30 +09:00
parent 18a808bccf
commit f9e49c80e7

View File

@ -223,8 +223,11 @@ update_card_removed (int vrdr, int value)
/* Let the card application layer know about the removal. */ /* Let the card application layer know about the removal. */
if (value) if (value)
{ {
int slot = vreader_slot (vrdr);
log_debug ("Removal of a card: %d\n", vrdr); log_debug ("Removal of a card: %d\n", vrdr);
application_notify_card_reset (vreader_slot (vrdr)); apdu_close_reader (slot);
application_notify_card_reset (slot);
vreader_table[vrdr].slot = -1; vreader_table[vrdr].slot = -1;
} }
} }
@ -2340,10 +2343,7 @@ update_reader_status_file (int set_card_removed_flag)
/* Set the card removed flag for all current sessions. */ /* Set the card removed flag for all current sessions. */
if (vr->any && vr->status == 0 && set_card_removed_flag) if (vr->any && vr->status == 0 && set_card_removed_flag)
{ update_card_removed (idx, 1);
apdu_close_reader (vr->slot);
update_card_removed (idx, 1);
}
vr->any = 1; vr->any = 1;