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

Rémi Denis-Courmont git at videolan.org
Sun Mar 11 21:30:28 CET 2018


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

posix: fix O_CLOEXEC flag in open/openat

(cherry picked from commit a0fbc944ce74cf4a3866e1fa7d7c36097e6136cb)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 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 2e393de719..0ddd762685 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -67,7 +67,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)
@@ -87,7 +87,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