summaryrefslogtreecommitdiffstats
path: root/stream/stream_file.c
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2016-01-06 23:08:13 +1100
committerJames Ross-Gowan <rossymiles@gmail.com>2016-01-07 23:37:06 +1100
commitc19f634e6cbdeaffed1d56ecd3a31c0652820cdf (patch)
treeade0dbf8d433ce9b7b60e6fe6051cb562572a39f /stream/stream_file.c
parent82e81421d737dae9a54098d8dc9d174c764340be (diff)
downloadmpv-c19f634e6cbdeaffed1d56ecd3a31c0652820cdf.tar.bz2
mpv-c19f634e6cbdeaffed1d56ecd3a31c0652820cdf.tar.xz
win32: fix fd://
Windows definitely supports Unix-style fd inheritance. This mostly worked when launched from mpv.exe, though mpv should change the file mode to O_BINARY. When launched from mpv.com, the wrapper must pass the list of handles (stored in the undocumented lpReserved2 and cbReserved2 fields) to the mpv process.
Diffstat (limited to 'stream/stream_file.c')
-rw-r--r--stream/stream_file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/stream/stream_file.c b/stream/stream_file.c
index 527261edd7..ce9f9d9739 100644
--- a/stream/stream_file.c
+++ b/stream/stream_file.c
@@ -262,9 +262,6 @@ static int open_f(stream_t *stream)
MP_INFO(stream, "Writing to stdout...\n");
p->fd = 1;
}
-#ifdef __MINGW32__
- setmode(p->fd, O_BINARY);
-#endif
p->close = false;
} else {
mode_t openmode = S_IRUSR | S_IWUSR;
@@ -298,6 +295,10 @@ static int open_f(stream_t *stream)
p->close = true;
}
+#ifdef __MINGW32__
+ setmode(p->fd, O_BINARY);
+#endif
+
off_t len = lseek(p->fd, 0, SEEK_END);
lseek(p->fd, 0, SEEK_SET);
if (len != (off_t)-1) {