diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libarchive/get_header_tar_gz.c | 4 | ||||
-rw-r--r-- | archival/tar.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/archival/libarchive/get_header_tar_gz.c b/archival/libarchive/get_header_tar_gz.c index b09f869..889fed0 100644 --- a/archival/libarchive/get_header_tar_gz.c +++ b/archival/libarchive/get_header_tar_gz.c @@ -9,7 +9,7 @@ char FAST_FUNC get_header_tar_gz(archive_handle_t *archive_handle) { #if BB_MMU - unsigned char magic[2]; + uint16_t magic; #endif /* Can't lseek over pipes */ @@ -21,7 +21,7 @@ char FAST_FUNC get_header_tar_gz(archive_handle_t *archive_handle) #if BB_MMU xread(archive_handle->src_fd, &magic, 2); /* Can skip this check, but error message will be less clear */ - if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { + if (magic != GZIP_MAGIC) { bb_error_msg_and_die("invalid gzip magic"); } #endif diff --git a/archival/tar.c b/archival/tar.c index e9dc41f..1e3cecf 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -1060,8 +1060,10 @@ int tar_main(int argc UNUSED_PARAM, char **argv) tar_handle->src_fd = tar_fd; tar_handle->seek = seek_by_read; } else { - if (ENABLE_FEATURE_TAR_AUTODETECT && flags == O_RDONLY) { - get_header_ptr = get_header_tar; + if (ENABLE_FEATURE_TAR_AUTODETECT + && flags == O_RDONLY + && get_header_ptr == get_header_tar + ) { tar_handle->src_fd = open_zipped(tar_filename); if (tar_handle->src_fd < 0) bb_perror_msg_and_die("can't open '%s'", tar_filename); |