aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2025-04-20 23:59:38 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2025-04-20 23:59:38 +0200
commitf13f68288f45708ff12e0f6853def5910acd32c7 (patch)
treeee1fefa294b84cb495f32c028860c1cdff948e9a
parentc61fdadf974205104f6690ad360117bdf86f0ba6 (diff)
downloadbusybox-w32-f13f68288f45708ff12e0f6853def5910acd32c7.tar.gz
busybox-w32-f13f68288f45708ff12e0f6853def5910acd32c7.tar.bz2
busybox-w32-f13f68288f45708ff12e0f6853def5910acd32c7.zip
rpm2cpio: extract cpio even if compression is not known
This is more useful than failing outright. function old new delta rpm2cpio_main 110 144 +34 .rodata 105681 105715 +34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 68/0) Total: 68 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/rpm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/archival/rpm.c b/archival/rpm.c
index 7fd2a2b46..95a8c79b6 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -533,6 +533,7 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
533 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 533 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */
534 // signal(SIGCHLD, check_errors_in_children); 534 // signal(SIGCHLD, check_errors_in_children);
535 535
536 str = NULL;
536 if (ENABLE_FEATURE_SEAMLESS_LZMA 537 if (ENABLE_FEATURE_SEAMLESS_LZMA
537 && (str = rpm_getstr0(TAG_PAYLOADCOMPRESSOR)) != NULL 538 && (str = rpm_getstr0(TAG_PAYLOADCOMPRESSOR)) != NULL
538 && strcmp(str, "lzma") == 0 539 && strcmp(str, "lzma") == 0
@@ -541,7 +542,11 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
541 // set up decompressor without detection 542 // set up decompressor without detection
542 setup_lzma_on_fd(rpm_fd); 543 setup_lzma_on_fd(rpm_fd);
543 } else { 544 } else {
544 setup_unzip_on_fd(rpm_fd, /*die_if_not_compressed:*/ 1); 545 int signature_bytes = setup_unzip_on_fd(rpm_fd, /*die_if_not_compressed:*/ 0);
546 if (signature_bytes != 0) {
547 xlseek(rpm_fd, - signature_bytes, SEEK_CUR);
548 bb_error_msg("warning, unknown compression '%s'", str);
549 }
545 } 550 }
546 551
547 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0) 552 if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0)