diff options
author | Max Kellermann <max@duempel.org> | 2008-10-29 21:11:20 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-29 21:11:20 +0100 |
commit | 84f7d9c6b322ccdc723a6304e5298c7edd5d1efd (patch) | |
tree | b4132fa54ea8522ed650edaf770d2ae12651f169 | |
parent | fb08213659dbccd6b483be98fa060be64fe6ea60 (diff) | |
download | mpd-84f7d9c6b322ccdc723a6304e5298c7edd5d1efd.tar.gz mpd-84f7d9c6b322ccdc723a6304e5298c7edd5d1efd.tar.xz mpd-84f7d9c6b322ccdc723a6304e5298c7edd5d1efd.zip |
input_file: check fstat() failure
-rw-r--r-- | src/input_file.c | 6 |
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 |