wok-next annotate busybox/stuff/busybox-1.12.0-rpm2cpio.u @ rev 4397
slitaz-loram-http: multi server support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Oct 18 14:07:57 2009 +0200 (2009-10-18) |
parents | |
children |
rev | line source |
---|---|
pascal@3963 | 1 Add bz2 support |
pascal@3963 | 2 --- busybox-1.12.0/archival/rpm2cpio.c |
pascal@3963 | 3 +++ busybox-1.12.0/archival/rpm2cpio.c |
pascal@3963 | 4 @@ -55,6 +55,7 @@ |
pascal@3963 | 5 struct rpm_lead lead; |
pascal@3963 | 6 int rpm_fd; |
pascal@3963 | 7 unsigned char magic[2]; |
pascal@3963 | 8 + USE_DESKTOP(long long) int FAST_FUNC (*unpack)(int src_fd, int dst_fd); |
pascal@3963 | 9 |
pascal@3963 | 10 if (argc == 1) { |
pascal@3963 | 11 rpm_fd = STDIN_FILENO; |
pascal@3963 | 12 @@ -75,11 +76,19 @@ |
pascal@3963 | 13 skip_header(rpm_fd); |
pascal@3963 | 14 |
pascal@3963 | 15 xread(rpm_fd, &magic, 2); |
pascal@3963 | 16 + unpack = unpack_gz_stream; |
pascal@3963 | 17 if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { |
pascal@3963 | 18 - bb_error_msg_and_die("invalid gzip magic"); |
pascal@3963 | 19 + if (!ENABLE_FEATURE_SEAMLESS_BZ2 |
pascal@3963 | 20 + || magic[0] != 'B' || magic[1] != 'Z' |
pascal@3963 | 21 + ) { |
pascal@3963 | 22 + bb_error_msg_and_die("invalid gzip" |
pascal@3963 | 23 + USE_FEATURE_SEAMLESS_BZ2("/bzip2") |
pascal@3963 | 24 + " magic"); |
pascal@3963 | 25 + } |
pascal@3963 | 26 + unpack = unpack_bz2_stream; |
pascal@3963 | 27 } |
pascal@3963 | 28 |
pascal@3963 | 29 - if (unpack_gz_stream(rpm_fd, STDOUT_FILENO) < 0) { |
pascal@3963 | 30 + if (unpack(rpm_fd, STDOUT_FILENO) < 0) { |
pascal@3963 | 31 bb_error_msg("error inflating"); |
pascal@3963 | 32 } |
pascal@3963 | 33 |