diff options
author | 2018-02-10 05:43:26 +0000 | |
---|---|---|
committer | 2018-02-10 05:43:26 +0000 | |
commit | d758803f75f8179e9f2c0de9f57c893a8281b8f8 (patch) | |
tree | 4bfb58c42ad2a023ceb25988465c1b176a0bf777 /usr.bin/ssh/ssh-keygen.c | |
parent | Similar to the IPv6 case create 127.0.0.1/8 on lo(4) interfaces which act (diff) | |
download | wireguard-openbsd-d758803f75f8179e9f2c0de9f57c893a8281b8f8.tar.xz wireguard-openbsd-d758803f75f8179e9f2c0de9f57c893a8281b8f8.zip |
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
Diffstat (limited to 'usr.bin/ssh/ssh-keygen.c')
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index 73a04865bc5..715025b3fb0 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -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 @@ -2823,7 +2823,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, |