Commit Graph

9 Commits

Author SHA1 Message Date
Tobias Rapp 4746653466 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>
2015-11-02 17:40:49 +01:00
Michael Niedermayer 097de4d1d6 Merge commit '9326d64ed1baadd7af60df6bbcc59cf1fefede48'
* commit '9326d64ed1baadd7af60df6bbcc59cf1fefede48':
  Share the utf8 to wchar conversion routine between lavf and lavu

Conflicts:
	libavformat/os_support.h
	libavutil/file_open.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-27 11:10:26 +01:00
Martin Storsjö 9326d64ed1 Share the utf8 to wchar conversion routine between lavf and lavu
This doesn't add any dependency on library internals, since this
only is a static inline function that gets built into each of the
calling functions - this is only to reduce the code duplication.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-27 09:29:17 +02:00
Michael Niedermayer 4aa7848eb8 avutil/file_open: Use av_mallocz_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-05 19:00:38 +02:00
Michael Niedermayer 85cabf1ca9 avutil: add av_fopen_utf8()
fopen() on windows uses UTF-16, we use UTF-8 everywhere, this
function bridges the gap by using avpriv_open()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 15:38:52 +01:00
Michael Niedermayer ad28fe35c5 avutil/file_open: Print debug message if setting close on exec fails
Fixes CID1087079
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-20 18:36:09 +02:00
Michael Niedermayer 5086b26809 libavutil/file_open.c: Fix duplicate words
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-12 19:40:29 +02:00
Michael Niedermayer ef13a005c4 Merge commit 'a76d0cdf21c3d9e464623cc0ad1c005abf952afa'
* commit 'a76d0cdf21c3d9e464623cc0ad1c005abf952afa':
  libavutil: Move avpriv_open to a new file, file_open.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-10 10:37:20 +02:00
Martin Storsjö a76d0cdf21 libavutil: Move avpriv_open to a new file, file_open.c
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-10 00:53:33 +03:00