summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/get_header_tar.c4
-rw-r--r--archival/tar.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index bf0f92b..4c063b3 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -91,7 +91,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
again_after_align:
-#if ENABLE_DESKTOP
+#if ENABLE_DESKTOP || ENABLE_FEATURE_TAR_AUTODETECT
/* to prevent misdetection of bz2 sig */
*(uint32_t*)(&tar) = 0;
i = full_read(archive_handle->src_fd, &tar, 512);
@@ -142,7 +142,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
#if ENABLE_FEATURE_TAR_AUTODETECT
char FAST_FUNC (*get_header_ptr)(archive_handle_t *);
- USE_DESKTOP(autodetect:)
+ autodetect:
/* tar gz/bz autodetect: check for gz/bz2 magic.
* If we see the magic, and it is the very first block,
* we can switch to get_header_tar_gz/bz2/lzma().
diff --git a/archival/tar.c b/archival/tar.c
index 47cc39c..b6beede 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -934,8 +934,10 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
tar_handle->src_fd = fileno(tar_stream);
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
+ && get_header_ptr == get_header_tar
+ && flags == O_RDONLY
+ ) {
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);