wok-next view busybox/stuff/busybox-1.12.0-rpm2cpio.u @ rev 4659
mpg123: fix build
author | Paul Issott <paul@slitaz.org> |
---|---|
date | Mon Dec 28 10:45:36 2009 +0000 (2009-12-28) |
parents | |
children |
line source
1 Add bz2 support
2 --- busybox-1.12.0/archival/rpm2cpio.c
3 +++ busybox-1.12.0/archival/rpm2cpio.c
4 @@ -55,6 +55,7 @@
5 struct rpm_lead lead;
6 int rpm_fd;
7 unsigned char magic[2];
8 + USE_DESKTOP(long long) int FAST_FUNC (*unpack)(int src_fd, int dst_fd);
10 if (argc == 1) {
11 rpm_fd = STDIN_FILENO;
12 @@ -75,11 +76,19 @@
13 skip_header(rpm_fd);
15 xread(rpm_fd, &magic, 2);
16 + unpack = unpack_gz_stream;
17 if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
18 - bb_error_msg_and_die("invalid gzip magic");
19 + if (!ENABLE_FEATURE_SEAMLESS_BZ2
20 + || magic[0] != 'B' || magic[1] != 'Z'
21 + ) {
22 + bb_error_msg_and_die("invalid gzip"
23 + USE_FEATURE_SEAMLESS_BZ2("/bzip2")
24 + " magic");
25 + }
26 + unpack = unpack_bz2_stream;
27 }
29 - if (unpack_gz_stream(rpm_fd, STDOUT_FILENO) < 0) {
30 + if (unpack(rpm_fd, STDOUT_FILENO) < 0) {
31 bb_error_msg("error inflating");
32 }