check that stat completes correctly

This commit is contained in:
Klas Lindfors
2014-11-10 10:07:35 +01:00
parent 4fd1cf953e
commit c14f53dfad
+4 -1
View File
@@ -417,7 +417,10 @@ static bool import_cert(ykpiv_state *state, enum enum_key_format cert_format,
} else if (cert_format == key_format_arg_GZIP) { } else if (cert_format == key_format_arg_GZIP) {
struct stat st; struct stat st;
fstat(fileno(input_file), &st); if(fstat(fileno(input_file), &st) == -1) {
fprintf(stderr, "Failed checking input GZIP file.\n");
goto import_cert_out;
}
cert_len = st.st_size; cert_len = st.st_size;
compress = 0x01; compress = 0x01;
} else { } else {