Commit 84f7d9c6 authored by Max Kellermann's avatar Max Kellermann

input_file: check fstat() failure

parent fb082136
...@@ -44,6 +44,12 @@ input_file_open(struct input_stream *is, const char *filename) ...@@ -44,6 +44,12 @@ input_file_open(struct input_stream *is, const char *filename)
is->seekable = true; is->seekable = true;
ret = fstat(fd, &st); ret = fstat(fd, &st);
if (ret < 0) {
is->error = errno;
close(fd);
return false;
}
is->size = st.st_size; is->size = st.st_size;
#ifdef POSIX_FADV_SEQUENTIAL #ifdef POSIX_FADV_SEQUENTIAL
......
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