As defined in POSIX-2008, mkstemp creates the file with 0600 permissions.
However there are some libc implementations (namely a few versions of Solaris
HP-UX and AIX) that do not still use the standard mask.

CC: [email protected]
Bug-Id: CID 739880
---
 libavcodec/libxvid_rc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index 68140a6..005e30f 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -25,6 +25,7 @@
 #if !HAVE_MKSTEMP
 #include <fcntl.h>
 #endif
+#include <sys/stat.h>
 #include <unistd.h>
 #include <xvid.h>
 
@@ -58,6 +59,7 @@ int ff_tempfile(const char *prefix, char **filename)
     fd = avpriv_open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
 #else
     snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
+    umask(S_IRUSR | S_IWUSR);
     fd = mkstemp(*filename);
     if (fd < 0) {
         snprintf(*filename, len, "./%sXXXXXX", prefix);
-- 
1.9.3 (Apple Git-50)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to