fsck: Fix ed25519 public key reading, and fclose usage.

Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net>
This commit is contained in:
Vittorio G (VittGam) 2016-10-11 13:30:05 +02:00 committed by GitHub
parent e6497a23f7
commit c7c5c74d4a

View file

@ -297,9 +297,10 @@ int fsck(const char *argv0) {
rsa_t *rsa_pub = NULL; rsa_t *rsa_pub = NULL;
f = fopen(fname, "r"); f = fopen(fname, "r");
if(f) if(f) {
rsa_pub = rsa_read_pem_public_key(f); rsa_pub = rsa_read_pem_public_key(f);
fclose(f); fclose(f);
}
if(rsa_priv) { if(rsa_priv) {
if(!rsa_pub) { if(!rsa_pub) {
@ -352,12 +353,12 @@ int fsck(const char *argv0) {
f = fopen(fname, "r"); f = fopen(fname, "r");
if(f) { if(f) {
ecdsa_pub = get_pubkey(f); ecdsa_pub = get_pubkey(f);
if(!f) { if(!ecdsa_pub) {
rewind(f); rewind(f);
ecdsa_pub = ecdsa_read_pem_public_key(f); ecdsa_pub = ecdsa_read_pem_public_key(f);
} }
fclose(f);
} }
fclose(f);
if(ecdsa_priv) { if(ecdsa_priv) {
if(!ecdsa_pub) { if(!ecdsa_pub) {