From 84f7d9c6b322ccdc723a6304e5298c7edd5d1efd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Oct 2008 21:11:20 +0100 Subject: input_file: check fstat() failure --- src/input_file.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/input_file.c') diff --git a/src/input_file.c b/src/input_file.c index c9543dff..8ed9c3d7 100644 --- a/src/input_file.c +++ b/src/input_file.c @@ -44,6 +44,12 @@ input_file_open(struct input_stream *is, const char *filename) is->seekable = true; ret = fstat(fd, &st); + if (ret < 0) { + is->error = errno; + close(fd); + return false; + } + is->size = st.st_size; #ifdef POSIX_FADV_SEQUENTIAL -- cgit v1.2.3