Unbreak handling of packages without epoch
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 2 Jun 2008 06:48:41 +0000 (09:48 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 2 Jun 2008 06:48:41 +0000 (09:48 +0300)
- rpmtdToString() returned NULL on empty data, rpmtdFormat() returns
  (unknown type) which isn't exactly appropriate value for epoch...

lib/rpmte.c

index 2212405..491a893 100644 (file)
@@ -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;