aboutsummaryrefslogtreecommitdiffstats
path: root/src/input_file.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-29 21:11:20 +0100
committerMax Kellermann <max@duempel.org>2008-10-29 21:11:20 +0100
commit84f7d9c6b322ccdc723a6304e5298c7edd5d1efd (patch)
treeb4132fa54ea8522ed650edaf770d2ae12651f169 /src/input_file.c
parentfb08213659dbccd6b483be98fa060be64fe6ea60 (diff)
downloadmpd-84f7d9c6b322ccdc723a6304e5298c7edd5d1efd.tar.gz
mpd-84f7d9c6b322ccdc723a6304e5298c7edd5d1efd.tar.xz
mpd-84f7d9c6b322ccdc723a6304e5298c7edd5d1efd.zip
input_file: check fstat() failure
Diffstat (limited to 'src/input_file.c')
-rw-r--r--src/input_file.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/input_file.c b/src/input_file.c
index c9543dff4..8ed9c3d75 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