agent: No cards is not an error.
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 17 Feb 2017 11:02:38 +0000 (20:02 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 17 Feb 2017 11:02:38 +0000 (20:02 +0900)
* agent/command-ssh.c (card_key_list): Care the case of no cards.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
agent/command-ssh.c

index 2c74618..7298700 100644 (file)
@@ -2387,9 +2387,15 @@ card_key_list (ctrl_t ctrl, char **r_serialno, strlist_t *result)
 {
   gpg_error_t err;
 
 {
   gpg_error_t err;
 
+  *r_serialno = NULL;
+  *result = NULL;
+
   err = agent_card_serialno (ctrl, r_serialno, NULL);
   if (err)
     {
   err = agent_card_serialno (ctrl, r_serialno, NULL);
   if (err)
     {
+      if (gpg_err_code (err) == GPG_ERR_ENODEV)
+        return 0;               /* Nothing available.  */
+
       if (opt.verbose)
         log_info (_("error getting serial number of card: %s\n"),
                   gpg_strerror (err));
       if (opt.verbose)
         log_info (_("error getting serial number of card: %s\n"),
                   gpg_strerror (err));