Commit 076c6701 authored by Daniel Salzman's avatar Daniel Salzman

yparser: fix fstat return check

parent 79253688
......@@ -98,10 +98,12 @@ int yp_set_input_file(
// Check for regular file input.
struct stat file_stat;
if (fstat(parser->file.descriptor, &file_stat) == -1 ||
!S_ISREG(file_stat.st_mode)) {
if (fstat(parser->file.descriptor, &file_stat) == -1) {
close(parser->file.descriptor);
return knot_map_errno();
} else if (!S_ISREG(file_stat.st_mode)) {
close(parser->file.descriptor);
return KNOT_EFILE;
}
char *start = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment