mirror of
https://git.tukaani.org/xz.git
synced 2026-10-31 03:14:56 +00:00
lzmainfo: Open named files in binary mode
On native Windows, lzmainfo opened named .lzma files in text mode while stdin was already binary. The C runtime treats 0x1A as EOF and translates CRLF in the 13-byte header. A valid file with a known uncompressed size of 26 bytes failed with "File is too small to be a .lzma file"; a known size of 2573 bytes was incorrectly reported as 10 bytes. Reading the same files through stdin or - reported the correct sizes. Closes: https://github.com/tukaani-project/xz/pull/253
This commit is contained in:
parent
4ea5cd06c5
commit
65e97f4826
@ -219,7 +219,7 @@ main(int argc, char **argv)
|
||||
if (lzmainfo("(stdin)", stdin))
|
||||
ret = EXIT_FAILURE;
|
||||
} else {
|
||||
FILE *f = fopen(argv[optind], "r");
|
||||
FILE *f = fopen(argv[optind], "rb");
|
||||
if (f == NULL) {
|
||||
ret = EXIT_FAILURE;
|
||||
fprintf(stderr, "%s: %s: %s\n",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user