Commit b616a490 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32: set close-on-exec where applicable

It's called O_NOINHERIT, but it really is the same as O_CLOEXEC.
As with POSIX, there is no way to set it for dup()/dup2() though.
parent c2e8e530
......@@ -69,15 +69,16 @@ int vlc_open (const char *filename, int flags, ...)
unsigned int mode = 0;
va_list ap;
flags |= O_NOINHERIT; /* O_CLOEXEC */
/* Defaults to binary mode */
if ((flags & O_TEXT) == 0)
flags |= O_BINARY;
va_start (ap, flags);
if (flags & O_CREAT)
mode = va_arg (ap, unsigned int);
va_end (ap);
/* Defaults to binary mode */
if ((flags & O_TEXT) == 0)
flags |= O_BINARY;
/*
* open() cannot open files with non-“ANSI” characters on Windows.
* We use _wopen() instead. Same thing for mkdir() and stat().
......@@ -271,7 +272,7 @@ int vlc_dup (int oldfd)
int vlc_pipe (int fds[2])
{
return _pipe (fds, 32768, O_BINARY);
return _pipe (fds, 32768, O_NOINHERIT | O_BINARY);
}
#include <vlc_network.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment