1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

gpg: Let --fetch-key return an exit code on failure.

* g10/keyserver.c (keyserver_fetch): Return an error code.
* g10/gpg.c (main) <aFetchKeys>: Return 1 in case of no data.
--

GnuPG-bug-id: 5376
This commit is contained in:
Werner Koch 2021-06-25 09:55:27 +02:00
parent 95d707e093
commit 9579c77862
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
2 changed files with 20 additions and 4 deletions

View file

@ -4874,12 +4874,14 @@ main (int argc, char **argv)
for( ; argc; argc--, argv++ )
append_to_strlist2( &sl, *argv, utf8_strings );
rc = keyserver_fetch (ctrl, sl, opt.key_origin);
free_strlist (sl);
if(rc)
{
write_status_failure ("fetch-keys", rc);
log_error ("key fetch failed: %s\n",gpg_strerror (rc));
if (gpg_err_code (rc) == GPG_ERR_NO_DATA)
g10_exit (1); /* In this case return 1 and not 2. */
}
free_strlist(sl);
break;
case aExportSecret: