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