diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-06-11 10:30:29 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-06-11 10:30:29 +0300 |
commit | 07b45099bbaf51d5a92516be06245be7e44972c9 (patch) | |
tree | f850c9d8d598996e95846e08a23d038f3d0ac098 /lib | |
parent | f32c97f621ae8726130c042db66481c1336cf620 (diff) | |
download | rpm-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.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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); |