rpmte te; /*!< current transaction element */
rpmfi fi; /*!< transaction element file info */
const char * stepName;
- const char * rpmio_flags;
+ char * rpmio_flags;
char * failedFile;
int scriptTag; /*!< Scriptlet data tag. */
int progTag; /*!< Scriptlet interpreter tag. */
(void) rpmpsmUnlink(psm, RPMDBG_M("rpmpsmFree"));
+ free(psm->rpmio_flags);
memset(psm, 0, sizeof(*psm)); /* XXX trash and burn */
psm = _free(psm);
break;
case PSM_RPMIO_FLAGS:
- { const char * payload_compressor = NULL;
+ { const char *compr = NULL;
struct rpmtd_s pc;
Header h = rpmteHeader(psm->te);
headerGet(h, RPMTAG_PAYLOADCOMPRESSOR, &pc, HEADERGET_DEFAULT);
- payload_compressor = rpmtdGetString(&pc);
- if (!payload_compressor)
- payload_compressor = "gzip";
- if (!strcmp(payload_compressor, "gzip"))
- psm->rpmio_flags = "r.gzdio";
- if (!strcmp(payload_compressor, "bzip2"))
- psm->rpmio_flags = "r.bzdio";
- if (!strcmp(payload_compressor, "xz"))
- psm->rpmio_flags = "r.xzdio";
- if (!strcmp(payload_compressor, "lzma"))
- psm->rpmio_flags = "r.lzdio";
+ compr = rpmtdGetString(&pc);
+ psm->rpmio_flags = rstrscat(NULL, "r.", compr ? compr : "gzip", NULL);
rpmtdFreeData(&pc);
headerFree(h);
{
FD_t fdi, fdo;
Header h;
- char * rpmio_flags;
+ char * rpmio_flags = NULL;
rpmRC rc;
FD_t gzdi;
}
/* 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);