teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.4.2-vercmp.patch

Paul Nasrat 57dc36
--- rpm-4.4.2/lib/rpmvercmp.c.vercmp	2005-07-03 22:32:22.000000000 -0400
Paul Nasrat 57dc36
+++ rpm-4.4.2/lib/rpmvercmp.c	2006-02-13 18:20:01.000000000 -0500
Paul Nasrat 57dc36
@@ -39,6 +39,9 @@
Paul Nasrat 57dc36
 	while (*one && !xisalnum(*one)) one++;
Paul Nasrat 57dc36
 	while (*two && !xisalnum(*two)) two++;
Paul Nasrat 57dc36
 
Paul Nasrat 57dc36
+	/* If we ran to the end of either, we are finished with the loop */
Paul Nasrat 57dc36
+	if (!(*one && *two)) break;
Paul Nasrat 57dc36
+
Paul Nasrat 57dc36
 	str1 = one;
Paul Nasrat 57dc36
 	str2 = two;
Paul Nasrat 57dc36
 
Paul Nasrat 57dc36
@@ -64,9 +67,13 @@
Paul Nasrat 57dc36
 	*str2 = '\0';
Paul Nasrat 57dc36
 /*@=boundswrite@*/
Paul Nasrat 57dc36
 
Paul Nasrat 57dc36
+	/* this cannot happen, as we previously tested to make sure that */
Paul Nasrat 57dc36
+	/* the first string has a non-null segment */
Paul Nasrat 57dc36
+	if (one == str1) return -1;	/* arbitrary */
Paul Nasrat 57dc36
+
Paul Nasrat 57dc36
 	/* take care of the case where the two version segments are */
Paul Nasrat 57dc36
 	/* different types: one numeric, the other alpha (i.e. empty) */
Paul Nasrat 57dc36
-	if (one == str1) return -1;	/* arbitrary */
Paul Nasrat 57dc36
+	/* numeric segments are always newer than alpha segments */
Paul Nasrat 57dc36
 	/* XXX See patch #60884 (and details) from bugzilla #50977. */
Paul Nasrat 57dc36
 	if (two == str2) return (isnum ? 1 : -1);
Paul Nasrat 57dc36