diff options
author | Ingo Klöcker <dev@ingo-kloecker.de> | 2022-08-09 12:02:28 +0200 |
---|---|---|
committer | Ingo Klöcker <dev@ingo-kloecker.de> | 2022-08-09 12:02:28 +0200 |
commit | 2cbb5760d758d971757b1b96109d8d09482a0f1c (patch) | |
tree | aa1786f511c920cef32ad58ba52c3efe1768c6ae /g10/keyedit.c | |
parent | gpg: Look up user ID to mark as primary by UID hash (diff) | |
download | gnupg2-2cbb5760d758d971757b1b96109d8d09482a0f1c.tar.xz gnupg2-2cbb5760d758d971757b1b96109d8d09482a0f1c.zip |
gpg: Emit an ERROR status if --quick-set-primary-uid fails
* g10/keyedit.c (keyedit_quick_set_primary): Issue a status error.
--
This allows GpgME to detect and report a failure if setting the primary
user ID of a key failed.
GnuPG-bug-id: 6126
Diffstat (limited to '')
-rw-r--r-- | g10/keyedit.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/g10/keyedit.c b/g10/keyedit.c index e087dcdd6..e4c754fae 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -2607,7 +2607,10 @@ keyedit_quick_set_primary (ctrl_t ctrl, const char *username, err = quick_find_keyblock (ctrl, username, 1, &kdbhd, &keyblock); if (err) - goto leave; + { + write_status_error ("keyedit.primary", err); + goto leave; + } /* Find the first matching UID that is valid */ primarynode = find_userid (keyblock, primaryuid, 1); @@ -2639,8 +2642,11 @@ keyedit_quick_set_primary (ctrl_t ctrl, const char *username, err = gpg_error (GPG_ERR_GENERAL); if (err) - log_error (_("setting the primary user ID failed: %s\n"), - gpg_strerror (err)); + { + log_error (_("setting the primary user ID failed: %s\n"), + gpg_strerror (err)); + write_status_error ("keyedit.primary", err); + } leave: release_kbnode (keyblock); |