diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-06 19:32:06 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-06 19:32:06 +0400 |
commit | 02c3c3842004d88207b46450dbd19f80e6596c7e (patch) | |
tree | 68890b6d081c3851b898f41bede25badc6b453fa /archival/libarchive/decompress_gunzip.c | |
parent | 8a6a2f9c9c214b94bd945acd97ac8b28c25e194e (diff) |
Move seamless .Z support into unpack_gz_stream
unpack_gz_stream 566 643 +77
unpack_gunzip 123 12 -111
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libarchive/decompress_gunzip.c')
-rw-r--r-- | archival/libarchive/decompress_gunzip.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c index f1c9a79e5..66152a853 100644 --- a/archival/libarchive/decompress_gunzip.c +++ b/archival/libarchive/decompress_gunzip.c @@ -1188,8 +1188,26 @@ unpack_gz_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd) IF_DESKTOP(long long) int total, n; DECLARE_STATE; +#if !ENABLE_FEATURE_SEAMLESS_Z if (check_signature16(aux, src_fd, GZIP_MAGIC)) return -1; +#else + if (aux && aux->check_signature) { + uint16_t magic2; + + if (full_read(STDIN_FILENO, &magic2, 2) != 2) { + bad_magic: + bb_error_msg("invalid magic"); + return -1; + } + if (magic2 == COMPRESS_MAGIC) { + aux->check_signature = 0; + return unpack_Z_stream(aux, src_fd, dst_fd); + } + if (magic2 != GZIP_MAGIC) + goto bad_magic; + } +#endif total = 0; |