mirror of
https://github.com/mpv-player/mpv
synced 2025-02-27 02:40:53 +00:00
stream: refuse to open directories
It's pointless.
This commit is contained in:
parent
3b83d43da3
commit
912e268931
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user