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
This commit is contained in:
Dan Nicholson 2012-10-10 05:48:04 -07:00
parent f50ba60ceb
commit f78b014371

View file

@ -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;