aboutsummaryrefslogtreecommitdiffstats
path: root/sm/keydb.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-13 14:08:42 +0000
committerWerner Koch <[email protected]>2016-01-13 14:08:42 +0000
commitc7ca0f73dbe7c080b79f93f90f00ba2396fc4bd0 (patch)
tree0148dd57d0618522515d0da351db23794cf0d1a8 /sm/keydb.c
parentgpg: Improve error code from lock_all. (diff)
downloadgnupg-c7ca0f73dbe7c080b79f93f90f00ba2396fc4bd0.tar.gz
gnupg-c7ca0f73dbe7c080b79f93f90f00ba2396fc4bd0.zip
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r--sm/keydb.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sm/keydb.c b/sm/keydb.c
index 0ef3c8f42..f5705cb45 100644
--- a/sm/keydb.c
+++ b/sm/keydb.c
@@ -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;
}