[FFmpeg-devel] [PATCH]Allow opening image files that are only readable by others

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Nov 11 12:53:03 CET 2012


Hi!

I succeeded on producing a test-case for ticket #1904 like this:
$ ls -l tests/lena.pnm
--w----r-- 1 root root 196668 Oct 21 19:06 tests/lena.pnm

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/file.c b/libavformat/file.c
index 209957b..e805dd9 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -90,8 +90,8 @@ static int file_check(URLContext *h, int mask)
     if (ret < 0)
         return AVERROR(errno);
 
-    ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ  : 0;
-    ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
+    ret |= st.st_mode&(S_IRUSR|S_IROTH) ? mask&AVIO_FLAG_READ  : 0;
+    ret |= st.st_mode&(S_IWUSR|S_IWOTH) ? mask&AVIO_FLAG_WRITE : 0;
 
     return ret;
 }


More information about the ffmpeg-devel mailing list