Bump to version 1.22.1
[platform/upstream/busybox.git] / archival / rpm2cpio.c
index 7256aae..61adde7 100644 (file)
@@ -7,6 +7,15 @@
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
+//config:config RPM2CPIO
+//config:      bool "rpm2cpio"
+//config:      default y
+//config:      help
+//config:        Converts a RPM file into a CPIO archive.
+
+//applet:IF_RPM2CPIO(APPLET(rpm2cpio, BB_DIR_USR_BIN, BB_SUID_DROP))
+//kbuild:lib-$(CONFIG_RPM2CPIO) += rpm2cpio.o
+
 //usage:#define rpm2cpio_trivial_usage
 //usage:       "package.rpm"
 //usage:#define rpm2cpio_full_usage "\n\n"
@@ -42,26 +51,6 @@ static unsigned skip_header(void)
        return sizeof(header) + len;
 }
 
-#if SEAMLESS_COMPRESSION
-static void handle_SIGCHLD(int signo UNUSED_PARAM)
-{
-       int status;
-
-       /* Wait for any child without blocking */
-       for (;;) {
-               if (wait_any_nohang(&status) < 0)
-                       /* wait failed?! I'm confused... */
-                       return;
-               if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
-                       /* this child exited with 0 */
-                       continue;
-               /* Cannot happen?
-               if (!WIFSIGNALED(status) && !WIFEXITED(status)) ???; */
-               bb_got_signal = 1;
-       }
-}
-#endif
-
 /* No getopt required */
 int rpm2cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
@@ -86,10 +75,9 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
        /* Skip the main header */
        skip_header();
 
-#if SEAMLESS_COMPRESSION
-       /* We need to know whether child (gzip/bzip/etc) exits abnormally */
-       signal(SIGCHLD, handle_SIGCHLD);
-#endif
+       //if (SEAMLESS_COMPRESSION)
+       //      /* We need to know whether child (gzip/bzip/etc) exits abnormally */
+       //      signal(SIGCHLD, check_errors_in_children);
 
        /* This works, but doesn't report uncompress errors (they happen in child) */
        setup_unzip_on_fd(rpm_fd, /*fail_if_not_detected:*/ 1);
@@ -100,9 +88,9 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
                close(rpm_fd);
        }
 
-#if SEAMLESS_COMPRESSION
-       return bb_got_signal;
-#else
+       if (SEAMLESS_COMPRESSION) {
+               check_errors_in_children(0);
+               return bb_got_signal;
+       }
        return EXIT_SUCCESS;
-#endif
 }