From 74d2bae4d3449c68453b0473dd3430ce91fd90c1 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Thu, 3 Nov 2011 17:07:22 +0200 Subject: xz: Fix xz on EBCDIC systems. Thanks to Chris Donawa. --- src/xz/coder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/xz') diff --git a/src/xz/coder.c b/src/xz/coder.c index 41193a7e..2ed88cdb 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -327,7 +327,10 @@ coder_set_compression_settings(void) static bool is_format_xz(void) { - return strm.avail_in >= 6 && memcmp(in_buf.u8, "\3757zXZ", 6) == 0; + // Specify the magic as hex to be compatible with EBCDIC systems. + static const uint8_t magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 }; + return strm.avail_in >= sizeof(magic) + && memcmp(in_buf.u8, magic, sizeof(magic)) == 0; } -- cgit v1.2.3