Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Rapp <t.rapp@noa-audio.com>2015-10-29 11:11:37 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-02 19:40:49 +0300
commit474665346616e446ecd1407002fdf5f88201bf72 (patch)
tree48189136709a962fce7ef4f811516d4d0dc198ce /libavutil/file_open.c
parent9ae73d0644cde27d3d93d41a5d8bc94de853ea91 (diff)
avutil/file_open: avoid file handle inheritance on Windows
Avoids inheritance of file handles on Windows systems similar to the O_CLOEXEC/FD_CLOEXEC flag on Linux. Fixes file lock issues in Windows applications when a child process is started with handle inheritance enabled (standard input/output redirection) while a FFmpeg transcoding is running in the parent process. Links relevant to the subject: https://msdn.microsoft.com/en-us/library/w7sa2b22.aspx Describes the _wsopen() function and the O_NOINHERIT flag. File handles opened by _wsopen() are inheritable by default. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx Describes handle inheritance when creating new processes. Handle inheritance must be enabled (bInheritHandles = TRUE) e.g. when you want to pass handles for stdin/stdout via lpStartupInfo. Signed-off-by: Tobias Rapp <t.rapp@noa-audio.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/file_open.c')
-rw-r--r--libavutil/file_open.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 3f9a67c3fc..9e76127919 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -77,6 +77,9 @@ int avpriv_open(const char *filename, int flags, ...)
#ifdef O_CLOEXEC
flags |= O_CLOEXEC;
#endif
+#ifdef O_NOINHERIT
+ flags |= O_NOINHERIT;
+#endif
fd = open(filename, flags, mode);
#if HAVE_FCNTL