]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Also compare build version if only one of the solvables has it
authorMichael Schroeder <mls@suse.de>
Wed, 17 Apr 2019 11:30:36 +0000 (13:30 +0200)
committerMichael Schroeder <mls@suse.de>
Wed, 17 Apr 2019 11:30:36 +0000 (13:30 +0200)
Spotted by Wolf Vollprecht

src/policy.c

index d6c9921be36f3aab3e0e833f2676bb723fb7b7bb..ccaea5a2e7a043492b0040d1cb47995ea6a58095 100644 (file)
@@ -834,14 +834,11 @@ move_installed_to_front(Pool *pool, Queue *plist)
 static int
 pool_buildversioncmp(Pool *pool, Solvable *s1, Solvable *s2)
 {
-  const char *bv2, *bv1 = solvable_lookup_str(s1, SOLVABLE_BUILDVERSION);
-  if (bv1)
-    {
-      bv2 = solvable_lookup_str(s2, SOLVABLE_BUILDVERSION);
-      if (bv1 != bv2)
-       return pool_evrcmp_str(pool, bv1, bv2, EVRCMP_COMPARE);
-    }
-  return 0;
+  const char *bv1 = solvable_lookup_str(s1, SOLVABLE_BUILDVERSION);
+  const char *bv2 = solvable_lookup_str(s2, SOLVABLE_BUILDVERSION);
+  if (!bv1 && !bv2)
+    return 0;
+  return pool_evrcmp_str(pool, bv1 ? bv1 : "" , bv2 ? bv2 : "", EVRCMP_COMPARE);
 }
 
 static int