teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame 0002-Only-attempt-loading-the-keyring-once-the-rpmdb-is-o.patch

DistroBaker d7a644
From 3cb955b77f07c70ba01d765aa6377908847608f5 Mon Sep 17 00:00:00 2001
DistroBaker d7a644
Message-Id: <3cb955b77f07c70ba01d765aa6377908847608f5.1606726599.git.pmatilai@redhat.com>
DistroBaker d7a644
In-Reply-To: <fd054a40b2ba005571455d749de0423975e77651.1606726599.git.pmatilai@redhat.com>
DistroBaker d7a644
References: <fd054a40b2ba005571455d749de0423975e77651.1606726599.git.pmatilai@redhat.com>
DistroBaker d7a644
From: Panu Matilainen <pmatilai@redhat.com>
DistroBaker d7a644
Date: Mon, 23 Nov 2020 13:46:14 +0200
DistroBaker d7a644
Subject: [PATCH 2/2] Only attempt loading the keyring once the rpmdb is open
DistroBaker d7a644
DistroBaker d7a644
When we do lazy rpmdb open in rpmtsInitIterator(), we also do a lazy
DistroBaker d7a644
keyring open. Except that since the keyring typically lives in the rpmdb,
DistroBaker d7a644
we PROBABLY should try open the database first. One of those "WTF I've
DistroBaker d7a644
been smoking" moments, lol.
DistroBaker d7a644
DistroBaker d7a644
Prevents an ugly if mostly harmless double error anything we can't open
DistroBaker d7a644
the database for one reason or another.
DistroBaker d7a644
---
DistroBaker d7a644
 lib/rpmts.c | 6 +++---
DistroBaker d7a644
 1 file changed, 3 insertions(+), 3 deletions(-)
DistroBaker d7a644
DistroBaker d7a644
diff --git a/lib/rpmts.c b/lib/rpmts.c
DistroBaker d7a644
index 9fa9cb0e2..8c8ae420a 100644
DistroBaker d7a644
--- a/lib/rpmts.c
DistroBaker d7a644
+++ b/lib/rpmts.c
DistroBaker d7a644
@@ -177,12 +177,12 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag,
DistroBaker d7a644
     if (ts == NULL)
DistroBaker d7a644
 	return NULL;
DistroBaker d7a644
 
DistroBaker d7a644
-    if (ts && ts->keyring == NULL)
DistroBaker d7a644
-	loadKeyring(ts);
DistroBaker d7a644
-
DistroBaker d7a644
     if (ts->rdb == NULL && rpmtsOpenDB(ts, ts->dbmode))
DistroBaker d7a644
 	return NULL;
DistroBaker d7a644
 
DistroBaker d7a644
+    if (ts->keyring == NULL)
DistroBaker d7a644
+	loadKeyring(ts);
DistroBaker d7a644
+
DistroBaker d7a644
     /* Parse out "N(EVR)" tokens from a label key if present */
DistroBaker d7a644
     if (rpmtag == RPMDBI_LABEL && keyp != NULL && strchr(keyp, '(')) {
DistroBaker d7a644
 	const char *se, *s = keyp;
DistroBaker d7a644
-- 
DistroBaker d7a644
2.28.0
DistroBaker d7a644