From 79ab6469ada53d629040d849e5ba61d3d8a81d8f Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 18 Nov 2020 13:56:14 +0200 Subject: 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... (cherry picked from commit fd054a40b2ba005571455d749de0423975e77651) --- lib/rpmdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rpmdb.c b/lib/rpmdb.c index 73187630b..38e1cb53f 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); } } -- cgit v1.2.1