[vlc-commits] posix: assume O_CLOEXEC is available
Rémi Denis-Courmont
git at videolan.org
Sat Sep 21 11:49:03 CEST 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Sep 21 10:58:38 2019 +0300| [e6e94a5e517ab612de9a0ab86b0000ca6801627e] | committer: Rémi Denis-Courmont
posix: assume O_CLOEXEC is available
Opening files without the O_CLOEXEC flag is a well-known long-standing
leakage bug. This was only supported because of MacOS < 10.7, support
for which was dropped in VLC 3.0 already.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e6e94a5e517ab612de9a0ab86b0000ca6801627e
---
src/posix/filesystem.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index d39158eb7d..2ac9c1187e 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -62,14 +62,7 @@ int vlc_open (const char *filename, int flags, ...)
mode = va_arg (ap, unsigned int);
va_end (ap);
-#ifdef O_CLOEXEC
return open(filename, flags | O_CLOEXEC, mode);
-#else
- int fd = open(filename, flags, mode);
- if (fd != -1)
- vlc_cloexec(fd);
- return -1;
-#endif
}
int vlc_openat (int dir, const char *filename, int flags, ...)
@@ -95,7 +88,7 @@ int vlc_openat (int dir, const char *filename, int flags, ...)
int vlc_mkstemp (char *template)
{
-#if defined (HAVE_MKOSTEMP) && defined (O_CLOEXEC)
+#if defined (HAVE_MKOSTEMP)
return mkostemp(template, O_CLOEXEC);
#else
int fd = mkstemp(template);
More information about the vlc-commits
mailing list