diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2011-06-09 11:32:39 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2011-06-09 11:32:39 +0300 |
commit | e07c86c6292d7b490abe393c90714cacc833820f (patch) | |
tree | fe96fd85c6251c55bd706f11d221f5956b111b91 | |
parent | f8c35a5768d6815a67d14bf0045ee0dd180a6798 (diff) | |
download | librpm-tizen-e07c86c6292d7b490abe393c90714cacc833820f.tar.gz librpm-tizen-e07c86c6292d7b490abe393c90714cacc833820f.tar.bz2 librpm-tizen-e07c86c6292d7b490abe393c90714cacc833820f.zip |
If key not specified, use DB_NEXT cursor mode (DB_SET wouldn't make sense)
-rw-r--r-- | lib/rpmdb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rpmdb.c b/lib/rpmdb.c index eb7260729..e86147b66 100644 --- a/lib/rpmdb.c +++ b/lib/rpmdb.c @@ -449,8 +449,9 @@ static int dbiCursorGetToSet(dbiCursor dbc, const char *keyp, size_t keylen, dbiIndexSet *set) { int rc = EINVAL; - if (dbc != NULL) { + if (dbc != NULL && set != NULL) { dbiIndex dbi = dbiCursorIndex(dbc); + int cflags = DB_NEXT; DBT data, key; memset(&data, 0, sizeof(data)); memset(&key, 0, sizeof(key)); @@ -458,9 +459,10 @@ static int dbiCursorGetToSet(dbiCursor dbc, const char *keyp, size_t keylen, if (keyp) { key.data = (void *) keyp; /* discards const */ key.size = keylen; + cflags = DB_SET; } - rc = dbiCursorGet(dbc, &key, &data, DB_SET); + rc = dbiCursorGet(dbc, &key, &data, cflags); if (rc == 0) { dbt2set(dbi, &data, set); |