diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-08-31 10:19:45 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-08-31 10:19:45 +0300 |
commit | 8e9662bd4cedd1fc9e31ae18bc420bc2b24c7be1 (patch) | |
tree | aae5c550d49ca58612c4dc3576acc6566c880a92 /rpm2cpio.c | |
parent | 5ca7197e33b0e02c42abc13ad953e5fa958f01f8 (diff) | |
download | librpm-tizen-8e9662bd4cedd1fc9e31ae18bc420bc2b24c7be1.tar.gz librpm-tizen-8e9662bd4cedd1fc9e31ae18bc420bc2b24c7be1.tar.bz2 librpm-tizen-8e9662bd4cedd1fc9e31ae18bc420bc2b24c7be1.zip |
Eliminate now unnecessary compressor -> ioflags conversions
Diffstat (limited to 'rpm2cpio.c')
-rw-r--r-- | rpm2cpio.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/rpm2cpio.c b/rpm2cpio.c index 787c0ae22..1270ea89d 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) { FD_t fdi, fdo; Header h; - char * rpmio_flags; + char * rpmio_flags = NULL; rpmRC rc; FD_t gzdi; @@ -70,26 +70,18 @@ int main(int argc, char *argv[]) } /* Retrieve type of payload compression. */ - { const char * payload_compressor = NULL; + { const char *compr = NULL; struct rpmtd_s pc; headerGet(h, RPMTAG_PAYLOADCOMPRESSOR, &pc, HEADERGET_DEFAULT); - payload_compressor = rpmtdGetString(&pc); - if (!payload_compressor) - payload_compressor = "gzip"; - - if (!strcmp(payload_compressor, "gzip")) - rpmio_flags = "r.gzdio"; - if (!strcmp(payload_compressor, "bzip2")) - rpmio_flags = "r.bzdio"; - if (!strcmp(payload_compressor, "xz")) - rpmio_flags = "r.xzdio"; - if (!strcmp(payload_compressor, "lzma")) - rpmio_flags = "r.lzdio"; + compr = rpmtdGetString(&pc); + rpmio_flags = rstrscat(NULL, "r.", compr ? compr : "gzip", NULL); rpmtdFreeData(&pc); } gzdi = Fdopen(fdi, rpmio_flags); /* XXX gzdi == fdi */ + free(rpmio_flags); + if (gzdi == NULL) { fprintf(stderr, _("cannot re-open payload: %s\n"), Fstrerror(gzdi)); exit(EXIT_FAILURE); |