wok-current diff busybox/stuff/busybox-1.12.0-rpm2cpio.u @ rev 3963
busybox/rpm2cpio: add bz2 support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 26 13:51:58 2009 +0200 (2009-08-26) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/busybox/stuff/busybox-1.12.0-rpm2cpio.u Wed Aug 26 13:51:58 2009 +0200 1.3 @@ -0,0 +1,33 @@ 1.4 +Add bz2 support 1.5 +--- busybox-1.12.0/archival/rpm2cpio.c 1.6 ++++ busybox-1.12.0/archival/rpm2cpio.c 1.7 +@@ -55,6 +55,7 @@ 1.8 + struct rpm_lead lead; 1.9 + int rpm_fd; 1.10 + unsigned char magic[2]; 1.11 ++ USE_DESKTOP(long long) int FAST_FUNC (*unpack)(int src_fd, int dst_fd); 1.12 + 1.13 + if (argc == 1) { 1.14 + rpm_fd = STDIN_FILENO; 1.15 +@@ -75,11 +76,19 @@ 1.16 + skip_header(rpm_fd); 1.17 + 1.18 + xread(rpm_fd, &magic, 2); 1.19 ++ unpack = unpack_gz_stream; 1.20 + if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { 1.21 +- bb_error_msg_and_die("invalid gzip magic"); 1.22 ++ if (!ENABLE_FEATURE_SEAMLESS_BZ2 1.23 ++ || magic[0] != 'B' || magic[1] != 'Z' 1.24 ++ ) { 1.25 ++ bb_error_msg_and_die("invalid gzip" 1.26 ++ USE_FEATURE_SEAMLESS_BZ2("/bzip2") 1.27 ++ " magic"); 1.28 ++ } 1.29 ++ unpack = unpack_bz2_stream; 1.30 + } 1.31 + 1.32 +- if (unpack_gz_stream(rpm_fd, STDOUT_FILENO) < 0) { 1.33 ++ if (unpack(rpm_fd, STDOUT_FILENO) < 0) { 1.34 + bb_error_msg("error inflating"); 1.35 + } 1.36 +