[Spice-devel] [PATCH spice-server 20/33 v2] replay: Force binary mode on input on Windows

Frediano Ziglio fziglio at redhat.com
Thu Jan 3 11:30:57 UTC 2019


If input contains the binary record we can't have it modified
during read.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/replay.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Changes since v1:
- open file passed with name in binary mode too.

diff --git a/server/tests/replay.c b/server/tests/replay.c
index cbb1c195..b88c03c7 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -392,8 +392,11 @@ int main(int argc, char **argv)
 
     if (strncmp(file[0], "-", 1) == 0) {
         fd = stdin;
+#ifdef _WIN32
+        _setmode(fileno(fd), _O_BINARY);
+#endif
     } else {
-        fd = fopen(file[0], "r");
+        fd = fopen(file[0], "rb");
     }
     if (fd == NULL) {
         g_printerr("error opening %s\n", file[0]);
-- 
2.20.1



More information about the Spice-devel mailing list