aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-11-27 11:26:48 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-11-27 11:26:48 +0100
commitf4fc303e3679e4ab0d45f60c31f9b687f27f7452 (patch)
treec270be417b97696e3a9897eab5602ce30faf313d /archival/tar.c
parent2d217799e8f23514ad3be6a951aa928c265bc6a4 (diff)
downloadbusybox-f4fc303e3679e4ab0d45f60c31f9b687f27f7452.tar.gz
tar: fix too eager autodetection, closes 11531
function old new delta is_suffixed_with - 54 +54 tar_main 1006 1026 +20 open_transformer 92 79 -13 config_file_action 478 458 -20 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/2 up/down: 74/-33) Total: 41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 1c71f7f66..6950c271d 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -1162,8 +1162,16 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
tar_handle->seek = seek_by_read;
} else
if (ENABLE_FEATURE_TAR_AUTODETECT
+ && ENABLE_FEATURE_SEAMLESS_LZMA
&& flags == O_RDONLY
&& !(opt & OPT_ANY_COMPRESS)
+ && is_suffixed_with(tar_filename, ".lzma")
+ /* We do this only for .lzma files, they have no signature.
+ * All other compression formats are recognized in
+ * get_header_tar() when first tar block has invalid format.
+ * Doing it here for all filenames would falsely trigger
+ * on e.g. tarball with 1st file named "BZh5".
+ */
) {
tar_handle->src_fd = open_zipped(tar_filename, /*fail_if_not_compressed:*/ 0);
if (tar_handle->src_fd < 0)