[vlc-commits] filesystem: deal with Linux O_TMPFILE open() flag correctly

Rémi Denis-Courmont git at videolan.org
Mon Aug 24 20:14:06 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 24 18:50:41 2015 +0300| [68e1c0ad66d0553eaf4e2d59566824ccad78322b] | committer: Rémi Denis-Courmont

filesystem: deal with Linux O_TMPFILE open() flag correctly

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=68e1c0ad66d0553eaf4e2d59566824ccad78322b
---

 src/posix/filesystem.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index a0f506f..0f3184b 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -42,6 +42,9 @@
 #endif
 #include <dirent.h>
 #include <sys/socket.h>
+#ifndef O_TMPFILE
+# define O_TMPFILE 0
+#endif
 
 #include <vlc_common.h>
 #include <vlc_fs.h>
@@ -53,7 +56,7 @@ int vlc_open (const char *filename, int flags, ...)
     va_list ap;
 
     va_start (ap, flags);
-    if (flags & O_CREAT)
+    if (flags & (O_CREAT|O_TMPFILE))
         mode = va_arg (ap, unsigned int);
     va_end (ap);
 
@@ -73,7 +76,7 @@ int vlc_openat (int dir, const char *filename, int flags, ...)
     va_list ap;
 
     va_start (ap, flags);
-    if (flags & O_CREAT)
+    if (flags & (O_CREAT|O_TMPFILE))
         mode = va_arg (ap, unsigned int);
     va_end (ap);
 



More information about the vlc-commits mailing list