Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/archival/rpm2cpio.c

    r2725 r3232  
    77 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
     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
    915#include "libbb.h"
    10 #include "archive.h"
     16#include "bb_archive.h"
    1117#include "rpm.h"
    1218
     
    6167    skip_header();
    6268
    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
    6473    /* 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);
    6675    if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0)
    6776        bb_error_msg_and_die("error unpacking");
    68 #else
    69     /* 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         } else
    82         if (ENABLE_FEATURE_SEAMLESS_BZ2
    83          && magic.b16[0] == BZIP2_MAGIC
    84         ) {
    85             unpack = unpack_bz2_stream;
    86         } else
    87         if (ENABLE_FEATURE_SEAMLESS_XZ
    88          && magic.b16[0] == XZ_MAGIC1
    89         ) {
    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 #endif
    10777
    10878    if (ENABLE_FEATURE_CLEAN_UP) {
     
    11080    }
    11181
    112     return 0;
     82    if (SEAMLESS_COMPRESSION) {
     83        check_errors_in_children(0);
     84        return bb_got_signal;
     85    }
     86    return EXIT_SUCCESS;
    11387}
Note: See TracChangeset for help on using the changeset viewer.