File bdbro_missingidx.diff of Package rpm.27835

--- lib/backend/bdb_ro.c.orig	2021-05-05 09:13:00.793868971 +0000
+++ lib/backend/bdb_ro.c	2021-05-05 09:14:41.333709445 +0000
@@ -609,10 +609,13 @@ static int bdbro_Open(rpmdb rdb, rpmDbiT
     rpmlog(RPMLOG_DEBUG, "opening  db index       %s\n", path);
     dbi->dbi_db = bdb_open(path);
     if (!dbi->dbi_db) {
-	rpmlog(RPMLOG_ERR, "could not open %s: %s\n", path, strerror(errno));
-	free(path);
-	dbiFree(dbi);
-	return 1;
+	int lvl = (dbi->dbi_type == DBI_PRIMARY) ? RPMLOG_ERR : RPMLOG_WARNING;
+	rpmlog(lvl, "could not open %s: %s\n", path, strerror(errno));
+	if (dbi->dbi_type == DBI_PRIMARY) {
+	    free(path);
+	    dbiFree(dbi);
+	    return 1;
+	}
     }
     free(path);
     dbi->dbi_flags |= DBI_RDONLY;
@@ -647,7 +650,7 @@ static int bdbro_Ctrl(rpmdb rdb, dbCtrlO
 
 static dbiCursor bdbro_CursorInit(dbiIndex dbi, unsigned int flags)
 {
-    return dbi ? (void *)cur_open(dbi->dbi_db) : NULL;
+    return (dbi && dbi->dbi_db) ? (void *)cur_open(dbi->dbi_db) : NULL;
 }
 
 static dbiCursor bdbro_CursorFree(dbiIndex dbi, dbiCursor dbc)
openSUSE Build Service is sponsored by