From beb573c2a02c20d593577c7b358d722ed1c021c4 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 2 Jun 2008 09:48:41 +0300 Subject: [PATCH] Unbreak handling of packages without epoch - rpmtdToString() returned NULL on empty data, rpmtdFormat() returns (unknown type) which isn't exactly appropriate value for epoch... --- lib/rpmte.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/rpmte.c b/lib/rpmte.c index 2212405..491a893 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -90,8 +90,11 @@ static void addTE(rpmts ts, rpmte p, Header h, p->version = xstrdup(version); p->release = xstrdup(release); - headerGet(h, RPMTAG_EPOCH, &td, HEADERGET_MINMEM); - p->epoch = rpmtdFormat(&td, RPMTD_FORMAT_STRING, NULL); + if (headerGet(h, RPMTAG_EPOCH, &td, HEADERGET_MINMEM)) { + p->epoch = rpmtdFormat(&td, RPMTD_FORMAT_STRING, NULL); + } else { + p->epoch = NULL; + } p->arch = arch ? xstrdup(arch) : NULL; p->archScore = arch ? rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch) : 0; -- 2.7.4