teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame 0001-Stop-on-first-failure-when-trying-to-open-a-database.patch

DistroBaker d7a644
From fd054a40b2ba005571455d749de0423975e77651 Mon Sep 17 00:00:00 2001
DistroBaker d7a644
Message-Id: <fd054a40b2ba005571455d749de0423975e77651.1606726599.git.pmatilai@redhat.com>
DistroBaker d7a644
From: Panu Matilainen <pmatilai@redhat.com>
DistroBaker d7a644
Date: Wed, 18 Nov 2020 13:56:14 +0200
DistroBaker d7a644
Subject: [PATCH 1/2] Stop on first failure when trying to open a database
DistroBaker d7a644
 (RhBug:1898301)
DistroBaker d7a644
DistroBaker d7a644
If an index open fails there's no point trying to go on, things are
DistroBaker d7a644
not going to work and at least BDB will segfault in some cases...
DistroBaker d7a644
---
DistroBaker d7a644
 lib/rpmdb.c | 2 +-
DistroBaker d7a644
 1 file changed, 1 insertion(+), 1 deletion(-)
DistroBaker d7a644
DistroBaker d7a644
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
DistroBaker d7a644
index 874f07911..41da9da71 100644
DistroBaker d7a644
--- a/lib/rpmdb.c
DistroBaker d7a644
+++ b/lib/rpmdb.c
DistroBaker d7a644
@@ -355,7 +355,7 @@ static int doOpen(rpmdb db, int justPkgs)
DistroBaker d7a644
 {
DistroBaker d7a644
     int rc = pkgdbOpen(db, db->db_flags, NULL);
DistroBaker d7a644
     if (!justPkgs) {
DistroBaker d7a644
-	for (int dbix = 0; dbix < db->db_ndbi; dbix++) {
DistroBaker d7a644
+	for (int dbix = 0; rc == 0 && dbix < db->db_ndbi; dbix++) {
DistroBaker d7a644
 	    rc += indexOpen(db, db->db_tags[dbix], db->db_flags, NULL);
DistroBaker d7a644
 	}
DistroBaker d7a644
     }
DistroBaker d7a644
-- 
DistroBaker d7a644
2.28.0
DistroBaker d7a644