scd: Fix return value for KEYINFO command.
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 15 May 2019 06:44:32 +0000 (15:44 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 15 May 2019 06:44:32 +0000 (15:44 +0900)
* scd/command.c (cmd_keyinfo): Return GPG_ERR_NOT_FOUND if none.

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

index 3bfc1a5..6b80341 100644 (file)
@@ -1851,6 +1851,7 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
   int action;
   char *keygrip_str;
   ctrl_t ctrl = assuan_get_pointer (ctx);
+  app_t a;
 
   list_mode = has_option (line, "--list");
   opt_data = has_option (line, "--data");
@@ -1866,8 +1867,10 @@ cmd_keyinfo (assuan_context_t ctx, char *line)
   else
     action = KEYGRIP_ACTION_WRITE_STATUS;
 
-  app_do_with_keygrip (ctrl, action, keygrip_str);
+  a = app_do_with_keygrip (ctrl, action, keygrip_str);
 
+  if (!list_mode && !a)
+    return gpg_error (GPG_ERR_NOT_FOUND);
   return 0;
 }