upstream commit

fatal if we're unable to write all the public key; previously
we would silently ignore errors writing the comment and terminating newline.
Prompted by github PR from WillerZ; ok dtucker

OpenBSD-Commit-ID: 18fbfcfd4e8c6adbc84820039b64d70906e49831
This commit is contained in:
djm@openbsd.org 2018-02-10 05:43:26 +00:00 committed by Damien Miller
parent cdb10bd431
commit b56ac069d4
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-keygen.c,v 1.310 2018/02/07 05:15:49 jsing Exp $ */
/* $OpenBSD: ssh-keygen.c,v 1.311 2018/02/10 05:43:26 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -2841,7 +2841,8 @@ passphrase_again:
if ((r = sshkey_write(public, f)) != 0)
error("write key failed: %s", ssh_err(r));
fprintf(f, " %s\n", comment);
fclose(f);
if (ferror(f) || fclose(f) != 0)
fatal("write public failed: %s", strerror(errno));
if (!quiet) {
fp = sshkey_fingerprint(public, fingerprint_hash,