diff options
author | Werner Koch <wk@gnupg.org> | 2021-08-19 14:08:14 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2021-08-19 14:09:27 +0200 |
commit | c1a23c3664753656bd4d22aafe0fb89d9bac5147 (patch) | |
tree | d3e8139c565651a49a7ec924e86cf6fd61273ca9 /g10/card-util.c | |
parent | agent: Use the sysconfdir for a pattern file. (diff) | |
download | gnupg2-c1a23c3664753656bd4d22aafe0fb89d9bac5147.tar.xz gnupg2-c1a23c3664753656bd4d22aafe0fb89d9bac5147.zip |
gpg: Return SUCCESS/FAILURE status also for --card-edit/name.
* g10/card-util.c (change_name): Call write_sc_op_status.
--
Reported-by: Joey Berkovitz
Diffstat (limited to '')
-rw-r--r-- | g10/card-util.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/g10/card-util.c b/g10/card-util.c index e79e9e508..f3ede6d46 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -787,7 +787,8 @@ static int change_name (void) { char *surname = NULL, *givenname = NULL; - char *isoname, *p; + char *isoname = NULL; + char *p; int rc; surname = get_one_name ("keygen.smartcard.surname", @@ -798,7 +799,8 @@ change_name (void) { xfree (surname); xfree (givenname); - return -1; /*canceled*/ + rc = gpg_error (GPG_ERR_CANCELED); + goto leave; } isoname = xmalloc ( strlen (surname) + 2 + strlen (givenname) + 1); @@ -814,14 +816,17 @@ change_name (void) tty_printf (_("Error: Combined name too long " "(limit is %d characters).\n"), 39); xfree (isoname); - return -1; + rc = gpg_error (GPG_ERR_TOO_LARGE); + goto leave; } rc = agent_scd_setattr ("DISP-NAME", isoname, strlen (isoname)); if (rc) log_error ("error setting Name: %s\n", gpg_strerror (rc)); + leave: xfree (isoname); + write_sc_op_status (rc); return rc; } |