aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-11-03 17:07:22 +0200
committerLasse Collin <lasse.collin@tukaani.org>2011-11-03 17:44:22 +0200
commit55fd02f83ecd6cbd6925a3e8a3d43b8d4ef2a17c (patch)
tree90c97a3638dc13c0410e3850e8197449020acb92
parentBuild: Fix "make check" on Windows. (diff)
downloadxz-55fd02f83ecd6cbd6925a3e8a3d43b8d4ef2a17c.tar.xz
xz: Fix xz on EBCDIC systems.
Thanks to Chris Donawa.
-rw-r--r--src/xz/coder.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index b123ec5b..69b1225d 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -284,7 +284,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;
}