summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-01-21 13:52:17 +0200
committerPanu Matilainen <pmatilai@redhat.com>2011-01-21 13:52:17 +0200
commita3ec6066af23e0c9e0de6160c14cb2a502e8fa89 (patch)
tree0717039aea02f163bf1731abd660725a95d11a82 /lib
parent5ddb36d2739653ebe50dc39176a9ca43d0555676 (diff)
downloadlibrpm-tizen-a3ec6066af23e0c9e0de6160c14cb2a502e8fa89.tar.gz
librpm-tizen-a3ec6066af23e0c9e0de6160c14cb2a502e8fa89.tar.bz2
librpm-tizen-a3ec6066af23e0c9e0de6160c14cb2a502e8fa89.zip
Fix rpmdb index match iteration termination with NULL keyp (#671149)
- When iterating secondary indexes with NULL keyp, the last entry was being returned twice as dbiAppendSet() would get called even when dbiGet() returned non-zero.
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmdb.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index e58de353b..dc6d7a71f 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -2048,10 +2048,9 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmDbiTagVal rpmtag,
/* get all entries from index */
xx = dbiCopen(dbi, &dbcursor, 0);
- while (rc==0) {
+ while ((rc = dbiGet(dbi, dbcursor, &key, &data, DB_NEXT)) == 0) {
dbiIndexSet newset = NULL;
- rc = dbiGet(dbi, dbcursor, &key, &data, DB_NEXT);
(void) dbt2set(dbi, &data, &newset);
if (set == NULL) {
set = newset;