diff options
author | NIIBE Yutaka <[email protected]> | 2021-08-20 06:22:28 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2021-08-20 06:22:28 +0000 |
commit | 1565baa93ae39a81c5b00ca4558cd24838b4ce54 (patch) | |
tree | c8ea7fffeb6c29b351aa1c87cb93064d49e05a4c /scd/apdu.c | |
parent | gpg: Return SUCCESS/FAILURE status also for --card-edit/name. (diff) | |
download | gnupg-1565baa93ae39a81c5b00ca4558cd24838b4ce54.tar.gz gnupg-1565baa93ae39a81c5b00ca4558cd24838b4ce54.zip |
scd: Don't release the context until list_finish for PC/SC.
* scd/apdu.c (apdu_dev_list_start): Increment PCSC.COUNT here.
(apdu_dev_list_finish): Decrement PCSC.COUNT.
--
GnuPG-bug-id: 5416
Fixes-commit: 32baa9acfb153004bdb2509f9516482b78f256a4
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/apdu.c')
-rw-r--r-- | scd/apdu.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scd/apdu.c b/scd/apdu.c index 8896508df..04bd3e2f3 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -2087,6 +2087,13 @@ apdu_dev_list_start (const char *portstr, struct dev_list **l_p) break; } } + + /* + * Increment PCSC.COUNT artificially, so that PCSC.CONTEXT can + * be kept (not released) until apdu_dev_list_finish will be + * called. + */ + pcsc.count++; } *l_p = dl; @@ -2112,7 +2119,7 @@ apdu_dev_list_finish (struct dev_list *dl) pcsc.rdrname[i] = NULL; npth_mutex_lock (&reader_table_lock); - if (pcsc.count == 0) + if (--pcsc.count == 0) release_pcsc_context (); npth_mutex_unlock (&reader_table_lock); } |