mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Set stdin and stdout to binary mode on Windows. This patch is
a forward port of b7b22fcb979a16d3a47c8001f058c9f7d4416068 from lzma-utils-legacy.git. I don't know if the new code base builds on Windows, but this is a start.
This commit is contained in:
parent
c9cba97691
commit
61d1784d8f
1 changed files with 9 additions and 0 deletions
|
@ -28,6 +28,10 @@ extern int errno;
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
# include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
#include "physmem.h"
|
#include "physmem.h"
|
||||||
|
|
||||||
|
@ -489,6 +493,11 @@ main(int argc, char **argv)
|
||||||
allocator.opaque = mem_limitter;
|
allocator.opaque = mem_limitter;
|
||||||
strm.allocator = &allocator;
|
strm.allocator = &allocator;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
setmode(fileno(stdin), O_BINARY);
|
||||||
|
setmode(fileno(stdout), O_BINARY);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (optind == argc) {
|
if (optind == argc) {
|
||||||
file = stdin;
|
file = stdin;
|
||||||
filename = "(stdin)";
|
filename = "(stdin)";
|
||||||
|
|
Loading…
Reference in a new issue