gpg-interface: simplify ssh fingerprint parsing

In "gpg-interface.c", the 'parse_ssh_output()' function takes a
'struct signature_check *sigc' argument and populates many members of
this 'sigc' using information parsed from 'sigc->output' which
contains the ouput of an `ssh-keygen -Y ...` command that was used to
verify an SSH signature.

When it populates 'sigc->fingerprint' though, it uses
`xstrdup(strstr(line, "key ") + 4)` while `strstr(line, "key ")` has
already been computed a few lines above and is already available in
the `key` variable.

Let's simplify this.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
main
Christian Couder 2025-10-30 13:33:28 +01:00 committed by Junio C Hamano
parent 419c72cb8a
commit ee74c5b167
1 changed files with 1 additions and 1 deletions

View File

@ -443,7 +443,7 @@ static void parse_ssh_output(struct signature_check *sigc)

key = strstr(line, "key ");
if (key) {
sigc->fingerprint = xstrdup(strstr(line, "key ") + 4);
sigc->fingerprint = xstrdup(key + 4);
sigc->key = xstrdup(sigc->fingerprint);
} else {
/*