aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2021-03-02 18:03:00 +0000
committerWerner Koch <[email protected]>2021-03-02 18:03:00 +0000
commit677245ba0e7d6c0bc85ac998f47e3f220b736840 (patch)
tree3bda9b8fdc06a25c167905c65ec3028f79e5281c
parentsm: On Windows close the kbx files at several places. (diff)
downloadgnupg-677245ba0e7d6c0bc85ac998f47e3f220b736840.tar.gz
gnupg-677245ba0e7d6c0bc85ac998f47e3f220b736840.zip
sm: Lock kbx files also before a search.
* sm/keydb.c (keydb_search): Lock files. -- This is required for Windows to avoid update locks. We use it also on Unix so that the locking behaviour is more or less indentical. GnuPG-bug-id: 4505
-rw-r--r--sm/keydb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sm/keydb.c b/sm/keydb.c
index 49d3404a3..df48cf953 100644
--- a/sm/keydb.c
+++ b/sm/keydb.c
@@ -931,7 +931,7 @@ int
keydb_search (ctrl_t ctrl, KEYDB_HANDLE hd,
KEYDB_SEARCH_DESC *desc, size_t ndesc)
{
- int rc = -1;
+ int rc;
unsigned long skipped;
if (!hd)
@@ -944,6 +944,11 @@ keydb_search (ctrl_t ctrl, KEYDB_HANDLE hd,
return gpg_error (GPG_ERR_NOT_FOUND);
}
+ rc = keydb_lock (hd);
+ if (rc)
+ return rc;
+ rc = -1;
+
while (rc == -1 && hd->current >= 0 && hd->current < hd->used)
{
switch (hd->active[hd->current].type)