summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-06-11 10:30:29 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-06-11 10:30:29 +0300
commit07b45099bbaf51d5a92516be06245be7e44972c9 (patch)
treef850c9d8d598996e95846e08a23d038f3d0ac098 /lib
parentf32c97f621ae8726130c042db66481c1336cf620 (diff)
downloadrpm-07b45099bbaf51d5a92516be06245be7e44972c9.tar.gz
rpm-07b45099bbaf51d5a92516be06245be7e44972c9.tar.bz2
rpm-07b45099bbaf51d5a92516be06245be7e44972c9.zip
Treat null epoch equal to zero epoch in freshen (rhbz#143301). Patch from JBJ.
Diffstat (limited to 'lib')
-rw-r--r--lib/psm.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/psm.c b/lib/psm.c
index ba187aac2..35e832819 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -62,25 +62,20 @@ int rpmVersionCompare(Header first, Header second)
{
const char * one, * two;
int_32 * epochOne, * epochTwo;
+ static int_32 zero = 0;
int rc;
if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (void **) &epochOne, NULL))
- epochOne = NULL;
+ epochOne = &zero;
if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (void **) &epochTwo, NULL))
- epochTwo = NULL;
+ epochTwo = &zero;
- if (epochOne != NULL && epochTwo == NULL)
- return 1;
- else if (epochOne == NULL && epochTwo != NULL)
- return -1;
- else if (epochOne != NULL && epochTwo != NULL) {
/*@-boundsread@*/
if (*epochOne < *epochTwo)
return -1;
else if (*epochOne > *epochTwo)
return 1;
/*@=boundsread@*/
- }
rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);