From: Vittorio G (VittGam) Date: Tue, 11 Oct 2016 11:30:05 +0000 (+0200) Subject: fsck: Fix ed25519 public key reading, and fclose usage. X-Git-Tag: release-1.1pre15~57 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=c7c5c74d4af7442b92d863fc9eb04395c456b0be;p=tinc fsck: Fix ed25519 public key reading, and fclose usage. Signed-off-by: Vittorio Gambaletta --- diff --git a/src/fsck.c b/src/fsck.c index b90710b9..e5e7dd5a 100644 --- a/src/fsck.c +++ b/src/fsck.c @@ -297,9 +297,10 @@ int fsck(const char *argv0) { rsa_t *rsa_pub = NULL; f = fopen(fname, "r"); - if(f) + if(f) { rsa_pub = rsa_read_pem_public_key(f); - fclose(f); + fclose(f); + } if(rsa_priv) { if(!rsa_pub) { @@ -352,12 +353,12 @@ int fsck(const char *argv0) { f = fopen(fname, "r"); if(f) { ecdsa_pub = get_pubkey(f); - if(!f) { + if(!ecdsa_pub) { rewind(f); ecdsa_pub = ecdsa_read_pem_public_key(f); } + fclose(f); } - fclose(f); if(ecdsa_priv) { if(!ecdsa_pub) {