[Pkg-gnupg-commit] [gnupg2] 15/132: scd: Don't keep CCID reader open when card is not available.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 17 03:07:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 3c93595d701c59cbc9b67a7fd0bcde7ee0fada1a
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Apr 7 12:18:16 2017 +0900

    scd: Don't keep CCID reader open when card is not available.
    
    * scd/apdu.c (open_ccid_reader): Fail if no ATR.
    
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
---
 scd/apdu.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/scd/apdu.c b/scd/apdu.c
index 147bf73..65f770d 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1496,6 +1496,9 @@ open_ccid_reader (struct dev_list *dl)
 
   err = ccid_open_reader (dl->portstr, dl->idx, dl->ccid_table,
                           &slotp->ccid.handle, &slotp->rdrname);
+  if (!err)
+    err = ccid_get_atr (slotp->ccid.handle,
+                        slotp->atr, sizeof slotp->atr, &slotp->atrlen);
   if (err)
     {
       slotp->used = 0;
@@ -1503,14 +1506,6 @@ open_ccid_reader (struct dev_list *dl)
       return -1;
     }
 
-  err = ccid_get_atr (slotp->ccid.handle,
-                      slotp->atr, sizeof slotp->atr, &slotp->atrlen);
-  if (err)
-    {
-      slotp->atrlen = 0;
-      err = 0;
-    }
-
   require_get_status = ccid_require_get_status (slotp->ccid.handle);
 
   reader_table[slot].close_reader = close_ccid_reader;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list