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