1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

kbx: Change return type of search functions to gpg_error_t.

* kbx/keybox-search.c (keybox_search_reset): Change return type to
gpg_error_t.
(keybox_search): Ditto.  Also handle GPG_ERR_EOF.
* sm/keydb.c (keydb_search_reset): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-01-13 15:08:42 +01:00
parent 9b6c91469a
commit c7ca0f73db
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 18 additions and 15 deletions

View file

@ -928,10 +928,11 @@ keydb_rebuild_caches (void)
/*
* Start the next search on this handle right at the beginning
*/
int
gpg_error_t
keydb_search_reset (KEYDB_HANDLE hd)
{
int i, rc = 0;
int i;
gpg_error_t rc = 0;
if (!hd)
return gpg_error (GPG_ERR_INV_VALUE);
@ -950,8 +951,7 @@ keydb_search_reset (KEYDB_HANDLE hd)
break;
}
}
return rc; /* fixme: we need to map error codes or share them with
all modules*/
return rc;
}
/*
@ -980,8 +980,10 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc)
NULL, &skipped);
break;
}
if (rc == -1) /* EOF -> switch to next resource */
hd->current++;
if (rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
{ /* EOF -> switch to next resource */
hd->current++;
}
else if (!rc)
hd->found = hd->current;
}

View file

@ -54,7 +54,7 @@ int keydb_delete (KEYDB_HANDLE hd, int unlock);
int keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved);
void keydb_rebuild_caches (void);
int keydb_search_reset (KEYDB_HANDLE hd);
gpg_error_t keydb_search_reset (KEYDB_HANDLE hd);
int keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc);
int keydb_search_first (KEYDB_HANDLE hd);
int keydb_search_next (KEYDB_HANDLE hd);