From 2cbb5760d758d971757b1b96109d8d09482a0f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 9 Aug 2022 12:02:28 +0200 Subject: [PATCH] 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 --- g10/keyedit.c | 12 +++++++++--- 1 file 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);