From f78b0143718163375d050a866d24567b4081f2ce Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 10 Oct 2012 05:48:04 -0700 Subject: [PATCH] rpmvercmp: Return -1/0/1 as function says it will strcmp is only guaranteed to return !0 when the strings are unmatched while rpmvercmp says it will return only -1 or 1 in those cases. pkg-config currently only checks for !0, so this doesn't actually fix any issues here. However, this is harmless and helps minimize the diff with upstream rpmvercmp. http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=ee64849e --- rpmvercmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpmvercmp.c b/rpmvercmp.c index 6de5c02..648026c 100644 --- a/rpmvercmp.c +++ b/rpmvercmp.c @@ -106,7 +106,7 @@ int rpmvercmp(const char * a, const char * b) /* if they are equal because there might be more segments to */ /* compare */ rc = strcmp(one, two); - if (rc) return rc; + if (rc) return (rc < 1 ? -1 : 1); /* restore character that was replaced by null above */ *str1 = oldch1;