mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 03:52:22 +02:00
stream_file: print strerror() when failing to open a file
stream_file always printed "File not found" if it could not open a file, even though this could be due to other reasons such as permission problems. Print strerror() information instead. This changes the output for "mplayer /etc/shadow" from File not found: '/etc/shadow' to Cannot open file '/etc/shadow': Permission denied
This commit is contained in:
parent
214edc0ef2
commit
202ea8214e
@ -23,6 +23,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "osdep/io.h"
|
||||
|
||||
@ -169,7 +170,8 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
|
||||
#endif
|
||||
f=open(filename,m, openmode);
|
||||
if(f<0) {
|
||||
mp_tmsg(MSGT_OPEN,MSGL_ERR,"File not found: '%s'\n",filename);
|
||||
mp_tmsg(MSGT_OPEN, MSGL_ERR, "Cannot open file '%s': %s\n", filename,
|
||||
strerror(errno));
|
||||
m_struct_free(&stream_opts,opts);
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user