diff options
author | Max Kellermann <max@duempel.org> | 2008-10-29 21:11:28 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-29 21:11:28 +0100 |
commit | 07bb46de88a6af3547d40452771e687a45592404 (patch) | |
tree | 25f36dea499bc52f1ca4993c0bd02aa03eaef380 /src | |
parent | 84f7d9c6b322ccdc723a6304e5298c7edd5d1efd (diff) | |
download | mpd-07bb46de88a6af3547d40452771e687a45592404.tar.gz mpd-07bb46de88a6af3547d40452771e687a45592404.tar.xz mpd-07bb46de88a6af3547d40452771e687a45592404.zip |
input_file: refuse to open non-regular files
Don't allow users to open a file which is non-regular (e.g. pipes,
devices).
Diffstat (limited to '')
-rw-r--r-- | src/input_file.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/input_file.c b/src/input_file.c index 8ed9c3d75..7806e15ab 100644 --- a/src/input_file.c +++ b/src/input_file.c @@ -50,6 +50,13 @@ input_file_open(struct input_stream *is, const char *filename) return false; } + if (!S_ISREG(st.st_mode)) { + g_debug("Not a regular file: %s\n", filename); + is->error = EINVAL; + close(fd); + return false; + } + is->size = st.st_size; #ifdef POSIX_FADV_SEQUENTIAL |