diff options
author | Werner Koch <[email protected]> | 2003-10-10 15:12:02 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2003-10-10 15:12:02 +0000 |
commit | 5a0fbad9b3f44440d63c5b17a4e4197f4561f1e4 (patch) | |
tree | 457d9d2379faa0f264b9a62d9a10f22211e43fad /g10/cardglue.c | |
parent | Add news about OpenPGP card support. (diff) | |
download | gnupg-5a0fbad9b3f44440d63c5b17a4e4197f4561f1e4.tar.gz gnupg-5a0fbad9b3f44440d63c5b17a4e4197f4561f1e4.zip |
* cardglue.c (card_close): New.
* ccid-driver.c (ccid_close_reader): New.
* apdu.c (close_ccid_reader, close_ct_reader, close_csc_reader)
(close_osc_reader, apdu_close_reader): New. Not all are properly
implemented yet.
* g10.c (g10_exit): Use close_card.
Diffstat (limited to 'g10/cardglue.c')
-rw-r--r-- | g10/cardglue.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/g10/cardglue.c b/g10/cardglue.c index 91637a776..1bd36b342 100644 --- a/g10/cardglue.c +++ b/g10/cardglue.c @@ -249,7 +249,7 @@ open_card (void) int rc; APP app; - current_app = NULL;/* FIXME: Release it first.*/ + card_close (); slot = apdu_open_reader (default_reader_port); if (slot == -1) { @@ -262,7 +262,7 @@ open_card (void) rc = app_select_openpgp (app, &app->serialno, &app->serialnolen); if (rc) { -/* apdu_close_reader (slot); */ + apdu_close_reader (slot); log_info ("selecting openpgp failed: %s\n", gpg_strerror (rc)); xfree (app); return NULL; @@ -273,6 +273,18 @@ open_card (void) return app; } +void +card_close (void) +{ + if (current_app) + { + APP app = current_app; + current_app = NULL; + + apdu_close_reader (app->slot); + xfree (app); + } +} /* Return a new malloced string by unescaping the string S. Escaping |