[vlc-commits] posix: fix O_CLOEXEC flag in open/openat

Rémi Denis-Courmont git at videolan.org
Sat Mar 10 21:20:54 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 10 21:55:31 2018 +0200| [a0fbc944ce74cf4a3866e1fa7d7c36097e6136cb] | committer: Rémi Denis-Courmont

posix: fix O_CLOEXEC flag in open/openat

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

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

diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index 95f108bee9..6c56013233 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -61,7 +61,7 @@ int vlc_open (const char *filename, int flags, ...)
     va_end (ap);
 
 #ifdef O_CLOEXEC
-    return open(filename, flags, mode | O_CLOEXEC);
+    return open(filename, flags | O_CLOEXEC, mode);
 #else
     int fd = open(filename, flags, mode);
     if (fd != -1)
@@ -81,7 +81,7 @@ int vlc_openat (int dir, const char *filename, int flags, ...)
     va_end (ap);
 
 #ifdef HAVE_OPENAT
-    return openat(dir, filename, flags, mode | O_CLOEXEC);
+    return openat(dir, filename, flags | O_CLOEXEC, mode);
 #else
     VLC_UNUSED (dir);
     VLC_UNUSED (filename);



More information about the vlc-commits mailing list