aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keydb.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/keydb.c')
-rw-r--r--g10/keydb.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/g10/keydb.c b/g10/keydb.c
index 590b45713..f155d8e7a 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -929,7 +929,7 @@ internal_keydb_deinit (KEYDB_HANDLE hd)
/* Take a lock on the files immediately and not only during insert or
* update. This lock is released with keydb_release. */
-gpg_error_t
+static gpg_error_t
internal_keydb_lock (KEYDB_HANDLE hd)
{
gpg_error_t err;
@@ -944,6 +944,20 @@ internal_keydb_lock (KEYDB_HANDLE hd)
}
+/* Take a lock if we are not using the keyboxd. */
+gpg_error_t
+keydb_lock (KEYDB_HANDLE hd)
+{
+ if (!hd)
+ return gpg_error (GPG_ERR_INV_ARG);
+
+ if (!hd->use_keyboxd)
+ return internal_keydb_lock (hd);
+
+ return 0;
+}
+
+
/* Set a flag on the handle to suppress use of cached results. This
* is required for updating a keyring and for key listings. Fixme:
* Using a new parameter for keydb_new might be a better solution. */