Hi Denys

The attached patch adds support for .txz and .tlzma tar archives. For
.txz the proper way would be to add the magic detection, but that was a
bit over my head right now, with four different magic parts.

- Lauri

-- 
http://www.fastmail.fm - A fast, anti-spam email service.

From caba4f803cdc2cdffca4f968d72a74185aa6cd58 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Wed, 29 Feb 2012 10:23:45 +0200
Subject: [PATCH] tar: support the common file extensions .tlzma and .txz

For lzma there is no magic to detect, so this is the right place.
For XZ, adding the magic detection makes the xz check here unnecessary.

Signed-off-by: Lauri Kasanen <[email protected]>
---
 libbb/read_printf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libbb/read_printf.c b/libbb/read_printf.c
index 0bbf780..fe1717c 100644
--- a/libbb/read_printf.c
+++ b/libbb/read_printf.c
@@ -341,13 +341,13 @@ int FAST_FUNC open_zipped(const char *fname)
 	sfx = strrchr(fname, '.');
 	if (sfx) {
 		sfx++;
-		if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
+		if (ENABLE_FEATURE_SEAMLESS_LZMA && strstr(sfx, "lzma"))
 			/* .lzma has no header/signature, just trust it */
 			open_transformer(fd, unpack_lzma_stream, "unlzma");
 		else
 		if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
 		 || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
-		 || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
+		 || (ENABLE_FEATURE_SEAMLESS_XZ && strstr(sfx, "xz"))
 		) {
 			setup_unzip_on_fd(fd /*, fail_if_not_detected: 1*/);
 		}
-- 
1.7.2.1

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to