diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-01-20 23:27:22 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-03-27 20:51:51 +0400 |
commit | e9cc98839574c7e8d546e890ebbf57d1766e5d8a (patch) | |
tree | 8c486d7131bff874dece844432c17f4233bd6f6c /libavformat | |
parent | cfe5908a72e72ac781d5e3ca02d9fab646e87881 (diff) |
win32: Allow other programs to open the same files
In order to match Linux behaviour better our Windows-specific
open() replacement should disable Windows default file locking.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/os_support.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/os_support.c b/libavformat/os_support.c index 451801ff70..1ecf43c3dc 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -32,6 +32,7 @@ #include <fcntl.h> #include <io.h> #include <windows.h> +#include <share.h> int ff_win32_open(const char *filename_utf8, int oflag, int pmode) { @@ -46,12 +47,12 @@ int ff_win32_open(const char *filename_utf8, int oflag, int pmode) filename_w = av_mallocz(sizeof(wchar_t) * num_chars); MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, filename_w, num_chars); - fd = _wopen(filename_w, oflag, pmode); + fd = _wsopen(filename_w, oflag, SH_DENYNO, pmode); av_freep(&filename_w); /* filename maybe be in CP_ACP */ if (fd == -1 && !(oflag & O_CREAT)) - return open(filename_utf8, oflag, pmode); + return _sopen(filename_utf8, oflag, SH_DENYNO, pmode); return fd; } |