From 4a1a5e81483a2f81b22c3a0d2cb054d93055998e Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 26 Oct 2001 04:16:19 +0000 Subject: - wire transactions through rpmcli install/erase modes. - legacy signatures always checked on package read. CVS patchset: 5134 CVS date: 2001/10/26 04:16:19 --- rpm2cpio.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'rpm2cpio.c') diff --git a/rpm2cpio.c b/rpm2cpio.c index c82d38c67..43025558e 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -2,7 +2,11 @@ #include "system.h" -#include "rpmlib.h" +#include +#include + +#include "depends.c" + #include "debug.h" int main(int argc, char **argv) @@ -10,7 +14,7 @@ int main(int argc, char **argv) FD_t fdi, fdo; Header h; char * rpmio_flags; - int rc, isSource; + rpmRC rc; FD_t gzdi; setprogname(argv[0]); /* Retrofit glibc __progname */ @@ -26,14 +30,33 @@ int main(int argc, char **argv) } fdo = fdDup(STDOUT_FILENO); - rc = rpmReadPackageHeader(fdi, &h, &isSource, NULL, NULL); +#ifdef DYING + rc = rpmReadPackageHeader(fdi, &h, NULL, NULL, NULL); +#else + { const char * rootDir = ""; + rpmdb db = NULL; + rpmTransactionSet ts = rpmtransCreateSet(db, rootDir); + + ts->need_payload = 1; + /*@-mustmod@*/ /* LCL: segfault */ + rc = rpmReadPackageFile(ts, fdi, "rpm2cpio", &h); + /*@=mustmod@*/ + ts->need_payload = 0; + + ts = rpmtransFree(ts); + } +#endif + switch (rc) { - case 0: + case RPMRC_BADSIZE: + case RPMRC_OK: break; - case 1: + case RPMRC_BADMAGIC: fprintf(stderr, _("argument is not an RPM package\n")); exit(EXIT_FAILURE); break; + case RPMRC_FAIL: + case RPMRC_SHORTREAD: default: fprintf(stderr, _("error reading header from package\n")); exit(EXIT_FAILURE); -- cgit v1.2.3