summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/utils/lzma-utils/src/lzmadec/lzmadec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Build/source/utils/lzma-utils/src/lzmadec/lzmadec.c b/Build/source/utils/lzma-utils/src/lzmadec/lzmadec.c
index c4f035d5204..457e9a8e730 100644
--- a/Build/source/utils/lzma-utils/src/lzmadec/lzmadec.c
+++ b/Build/source/utils/lzma-utils/src/lzmadec/lzmadec.c
@@ -12,6 +12,12 @@
#define CHUNKSIZE_IN 4096
#define CHUNKSIZE_OUT (1024*512)
+
+/* for O_BINARY: */
+#ifdef WIN32
+#include <fcntl.h>
+#endif
+
int main(int argc, char **argv)
{
int ret;
@@ -38,6 +44,12 @@ int main(int argc, char **argv)
return 0;
}
+ /*
+ * Windows: set stdin/stdout to binary mode */
+ #ifdef WIN32
+ setmode(fileno(stdout), O_BINARY);
+ setmode(fileno(stdin), O_BINARY);
+ #endif
if (buffer_in == NULL || buffer_out == NULL) {
fprintf (stderr, "%s: Not enough memory.\n", argv[0]);
return 5;