summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-02-19 17:33:36 +0100
committerwm4 <wm4@mplayer2.org>2012-02-19 17:33:36 +0100
commit912e268931c5f1529c620a77f23f5c5709d32e29 (patch)
tree0a8aa8910c046a76f3a7aa5dd200f326064843f5 /stream
parent3b83d43da3402f8bfc823d8f1888e38d7619d271 (diff)
downloadmpv-912e268931c5f1529c620a77f23f5c5709d32e29.tar.bz2
mpv-912e268931c5f1529c620a77f23f5c5709d32e29.tar.xz
stream: refuse to open directories
It's pointless.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/stream/stream_file.c b/stream/stream_file.c
index 6d436cf6f5..22fdcd7e2e 100644
--- a/stream/stream_file.c
+++ b/stream/stream_file.c
@@ -171,6 +171,15 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}
+#ifndef __MINGW32__
+ struct stat st;
+ if (fstat(f, &st) == 0 && S_ISDIR(st.st_mode)) {
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"File is a directory: '%s'\n",filename);
+ close(f);
+ m_struct_free(&stream_opts,opts);
+ return STREAM_ERROR;
+ }
+#endif
}
len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);