aboutsummaryrefslogtreecommitdiff
path: root/src/lzmadec/lzmadec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lzmadec/lzmadec.c')
-rw-r--r--src/lzmadec/lzmadec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lzmadec/lzmadec.c b/src/lzmadec/lzmadec.c
index 10d5cc60..eca58b98 100644
--- a/src/lzmadec/lzmadec.c
+++ b/src/lzmadec/lzmadec.c
@@ -28,6 +28,10 @@ extern int errno;
#include <stdio.h>
#include <unistd.h>
+#ifdef WIN32
+# include <fcntl.h>
+#endif
+
#include "getopt.h"
#include "physmem.h"
@@ -489,6 +493,11 @@ main(int argc, char **argv)
allocator.opaque = mem_limitter;
strm.allocator = &allocator;
+#ifdef WIN32
+ setmode(fileno(stdin), O_BINARY);
+ setmode(fileno(stdout), O_BINARY);
+#endif
+
if (optind == argc) {
file = stdin;
filename = "(stdin)";