rev |
line source |
pascal@15734
|
1 Add LZMA_DEFAULT_MAGIC support
|
pascal@15777
|
2 --- busybox-1.20/archival/libarchive/open_transformer.c
|
pascal@15734
|
3 +++ busybox-1.20/archival/libarchive/open_transformer.c
|
pascal@15743
|
4 @@ -132,6 +132,21 @@
|
pascal@15734
|
5 /* .gz and .bz2 both have 2-byte signature, and their
|
pascal@15734
|
6 * unpack_XXX_stream wants this header skipped. */
|
pascal@15734
|
7 xread(fd, magic.b16, sizeof(magic.b16[0]));
|
pascal@15734
|
8 +#if 1
|
pascal@15734
|
9 +// SliTaz uses .gz suffix for lzma'd kernel modules
|
pascal@15734
|
10 +#if BB_BIG_ENDIAN
|
pascal@15734
|
11 +#define LZMA_DEFAULT_MAGIC 0x5d00
|
pascal@15734
|
12 +#else
|
pascal@15734
|
13 +#define LZMA_DEFAULT_MAGIC 0x5d
|
pascal@15734
|
14 +#endif
|
pascal@15734
|
15 + if (ENABLE_FEATURE_SEAMLESS_LZMA
|
pascal@15734
|
16 + && magic.b16[0] == LZMA_DEFAULT_MAGIC
|
pascal@15734
|
17 + ) {
|
pascal@15734
|
18 + xlseek(fd, offset, SEEK_CUR);
|
pascal@15734
|
19 + open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma");
|
pascal@15734
|
20 + return 0;
|
pascal@15734
|
21 + }
|
pascal@15734
|
22 +#endif
|
pascal@15734
|
23 if (ENABLE_FEATURE_SEAMLESS_GZ
|
pascal@15734
|
24 && magic.b16[0] == GZIP_MAGIC
|
pascal@15734
|
25 ) {
|
pascal@16927
|
26 @@ -190,17 +205,17 @@
|
pascal@15777
|
27 return fd;
|
pascal@15777
|
28
|
pascal@15777
|
29 sfx = strrchr(fname, '.');
|
pascal@15777
|
30 - if (sfx) {
|
pascal@15777
|
31 - sfx++;
|
pascal@15777
|
32 - if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
|
pascal@15777
|
33 - /* .lzma has no header/signature, just trust it */
|
pascal@15777
|
34 - open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma");
|
pascal@15777
|
35 - else
|
pascal@15777
|
36 - if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
|
pascal@15777
|
37 - || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
|
pascal@15777
|
38 - || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
|
pascal@15777
|
39 + if (sfx++ && ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0) {
|
pascal@15777
|
40 + /* .lzma has no header/signature, just trust it */
|
pascal@15777
|
41 + open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma");
|
pascal@15777
|
42 + }
|
pascal@15777
|
43 + else {
|
pascal@15777
|
44 + if ((ENABLE_FEATURE_SEAMLESS_GZ)
|
pascal@15777
|
45 + || (ENABLE_FEATURE_SEAMLESS_BZ2)
|
pascal@15777
|
46 + || (ENABLE_FEATURE_SEAMLESS_LZMA)
|
pascal@15777
|
47 + || (ENABLE_FEATURE_SEAMLESS_XZ)
|
pascal@15777
|
48 ) {
|
pascal@15852
|
49 - setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
|
pascal@15852
|
50 + setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 0);
|
pascal@15777
|
51 }
|
pascal@16927
|
52 }
|
pascal@16811
|
53
|