diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2020-11-23 13:46:14 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2020-12-10 13:28:07 +0200 |
commit | 42215619820e229f8011a7c80e9932d7962e0b05 (patch) | |
tree | 7e635f98f15598f790c3b4005bdaf67a6b0e6a8a | |
parent | 79ab6469ada53d629040d849e5ba61d3d8a81d8f (diff) | |
download | rpm-42215619820e229f8011a7c80e9932d7962e0b05.tar.gz |
Only attempt loading the keyring once the rpmdb is open
When we do lazy rpmdb open in rpmtsInitIterator(), we also do a lazy
keyring open. Except that since the keyring typically lives in the rpmdb,
we PROBABLY should try open the database first. One of those "WTF I've
been smoking" moments, lol.
Prevents an ugly if mostly harmless double error anything we can't open
the database for one reason or another.
(cherry picked from commit 3cb955b77f07c70ba01d765aa6377908847608f5)
-rw-r--r-- | lib/rpmts.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rpmts.c b/lib/rpmts.c index 1d2027bfa..a517a8e44 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -177,12 +177,12 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, if (ts == NULL) return NULL; - if (ts && ts->keyring == NULL) - loadKeyring(ts); - if (ts->rdb == NULL && rpmtsOpenDB(ts, ts->dbmode)) return NULL; + if (ts->keyring == NULL) + loadKeyring(ts); + /* Parse out "N(EVR)" tokens from a label key if present */ if (rpmtag == RPMDBI_LABEL && keyp != NULL && strchr(keyp, '(')) { const char *se, *s = keyp; |