Browse Source

Merge branch 'pw/ssh-sign-report-errors' into maint-2.38

The codepath to sign learned to report errors when it fails to read
from "ssh-keygen".

* pw/ssh-sign-report-errors:
  ssh signing: return an error when signature cannot be read
maint
Junio C Hamano 2 years ago
parent
commit
48b754ddc0
  1. 7
      gpg-interface.c

7
gpg-interface.c

@ -1059,12 +1059,11 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature, @@ -1059,12 +1059,11 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
strbuf_addbuf(&ssh_signature_filename, &buffer_file->filename);
strbuf_addstr(&ssh_signature_filename, ".sig");
if (strbuf_read_file(signature, ssh_signature_filename.buf, 0) < 0) {
error_errno(
ret = error_errno(
_("failed reading ssh signing data buffer from '%s'"),
ssh_signature_filename.buf);
goto out;
}
unlink_or_warn(ssh_signature_filename.buf);

/* Strip CR from the line endings, in case we are on Windows. */
remove_cr_after(signature, bottom);

@ -1073,6 +1072,8 @@ out: @@ -1073,6 +1072,8 @@ out:
delete_tempfile(&key_file);
if (buffer_file)
delete_tempfile(&buffer_file);
if (ssh_signature_filename.len)
unlink_or_warn(ssh_signature_filename.buf);
strbuf_release(&signer_stderr);
strbuf_release(&ssh_signature_filename);
FREE_AND_NULL(ssh_signing_key_file);

Loading…
Cancel
Save