Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/archival/rpm2cpio.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/archival/rpm2cpio.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define rpm2cpio_trivial_usage 11 //usage: "package.rpm" 12 //usage:#define rpm2cpio_full_usage "\n\n" 13 //usage: "Output a cpio archive of the rpm file" 14 9 15 #include "libbb.h" 10 #include " archive.h"16 #include "bb_archive.h" 11 17 #include "rpm.h" 12 18 … … 61 67 skip_header(); 62 68 63 #if 0 69 //if (SEAMLESS_COMPRESSION) 70 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 71 // signal(SIGCHLD, check_errors_in_children); 72 64 73 /* This works, but doesn't report uncompress errors (they happen in child) */ 65 setup_unzip_on_fd(rpm_fd /*fail_if_not_detected: 1*/);74 setup_unzip_on_fd(rpm_fd, /*fail_if_not_detected:*/ 1); 66 75 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0) 67 76 bb_error_msg_and_die("error unpacking"); 68 #else69 /* BLOAT */70 {71 union {72 uint8_t b[4];73 uint16_t b16[2];74 uint32_t b32[1];75 } magic;76 IF_DESKTOP(long long) int FAST_FUNC (*unpack)(int src_fd, int dst_fd);77 78 xread(rpm_fd, magic.b16, sizeof(magic.b16[0]));79 if (magic.b16[0] == GZIP_MAGIC) {80 unpack = unpack_gz_stream;81 } else82 if (ENABLE_FEATURE_SEAMLESS_BZ283 && magic.b16[0] == BZIP2_MAGIC84 ) {85 unpack = unpack_bz2_stream;86 } else87 if (ENABLE_FEATURE_SEAMLESS_XZ88 && magic.b16[0] == XZ_MAGIC189 ) {90 xread(rpm_fd, magic.b32, sizeof(magic.b32[0]));91 if (magic.b32[0] != XZ_MAGIC2)92 goto no_magic;93 /* unpack_xz_stream wants fd at position 6, no need to seek */94 //xlseek(rpm_fd, -6, SEEK_CUR);95 unpack = unpack_xz_stream;96 } else {97 no_magic:98 bb_error_msg_and_die("no gzip"99 IF_FEATURE_SEAMLESS_BZ2("/bzip2")100 IF_FEATURE_SEAMLESS_XZ("/xz")101 " magic");102 }103 if (unpack(rpm_fd, STDOUT_FILENO) < 0)104 bb_error_msg_and_die("error unpacking");105 }106 #endif107 77 108 78 if (ENABLE_FEATURE_CLEAN_UP) { … … 110 80 } 111 81 112 return 0; 82 if (SEAMLESS_COMPRESSION) { 83 check_errors_in_children(0); 84 return bb_got_signal; 85 } 86 return EXIT_SUCCESS; 113 87 }
Note:
See TracChangeset
for help on using the changeset viewer.