gpg: Print a hint for --batch mode and --delete-secret-key.

* g10/delkey.c: Include shareddefs.h.
(delete_keys): Print a hint.
--

The option --yes has some side-effects so it is not desirable to use it
automatically.  The code in master (2.3) has special treatment of
confirm messages and thus this patch is only for 2.2.

GnuPG-bug-id: 4667
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-03-18 15:26:43 +01:00
parent 25dc0e5b1e
commit fbe3184752
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,7 @@
#include "filter.h"
#include "../common/ttyio.h"
#include "../common/i18n.h"
#include "../common/shareddefs.h"
#include "call-agent.h"
@ -368,6 +369,11 @@ delete_keys (ctrl_t ctrl, strlist_t names, int secret, int allow_both)
{
log_error ("%s: delete key failed: %s\n",
names->d, gpg_strerror (err));
if (gpg_err_code (err) == GPG_ERR_NO_PIN_ENTRY
&& opt.batch && secret
&& opt.pinentry_mode == PINENTRY_MODE_LOOPBACK)
log_info ("(try option \"--yes\" to delete anyway)\n");
return err;
}
}