g10: Have keydb_search_first call keydb_search_reset before searching.

* g10/keydb.c (keydb_search_first): Reset the handle before starting
the search.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.

This bug hasn't shown up yet in practice, because keydb_search_first
is always called immediately after a keydb_new.  This changes cleans
up the semantics and will hopefully prevent future bugs.
This commit is contained in:
Neal H. Walfield 2015-08-31 09:22:23 +02:00
parent 0377db4b35
commit 11d8ffc939
1 changed files with 4 additions and 0 deletions

View File

@ -1731,6 +1731,10 @@ keydb_search_first (KEYDB_HANDLE hd)
gpg_error_t err;
KEYDB_SEARCH_DESC desc;
err = keydb_search_reset (hd);
if (err)
return err;
memset (&desc, 0, sizeof desc);
desc.mode = KEYDB_SEARCH_MODE_FIRST;
err = keydb_search (hd, &desc, 1, NULL);