aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-10-14 07:45:08 +0000
committerNIIBE Yutaka <[email protected]>2025-10-21 04:19:25 +0000
commit4050139d46fba2b50d95cd404ceb39c72efd1bb2 (patch)
tree17617c2892d379bf63879cb57c32c43c47ce183c
parentcommon,w32: Always use share mode readwrite for the keybox. (diff)
downloadgnupg-4050139d46fba2b50d95cd404ceb39c72efd1bb2.tar.gz
gnupg-4050139d46fba2b50d95cd404ceb39c72efd1bb2.zip
gpg: Minor clean up for keydb_lock API.
* g10/keydb-private.h (internal_keydb_lock): Remove. * g10/keydb.c (internal_keydb_lock): It's internal function. * g10/call-keyboxd.c (keydb_lock): Move to... * g10/keydb.c (keydb_lock): ... here. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--g10/call-keyboxd.c14
-rw-r--r--g10/keydb-private.h1
-rw-r--r--g10/keydb.c16
3 files changed, 15 insertions, 16 deletions
diff --git a/g10/call-keyboxd.c b/g10/call-keyboxd.c
index 1bfcae345..5cb6be512 100644
--- a/g10/call-keyboxd.c
+++ b/g10/call-keyboxd.c
@@ -326,20 +326,6 @@ keydb_release (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;
-}
-
-
/* Return the keyblock last found by keydb_search() in *RET_KB.
*
* On success, the function returns 0 and the caller must free *RET_KB
diff --git a/g10/keydb-private.h b/g10/keydb-private.h
index dae05d658..dd404285e 100644
--- a/g10/keydb-private.h
+++ b/g10/keydb-private.h
@@ -162,7 +162,6 @@ gpg_error_t keydb_parse_keyblock (iobuf_t iobuf, int pk_no, int uid_no,
gpg_error_t internal_keydb_init (KEYDB_HANDLE hd);
void internal_keydb_deinit (KEYDB_HANDLE hd);
-gpg_error_t internal_keydb_lock (KEYDB_HANDLE hd);
gpg_error_t internal_keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb);
gpg_error_t internal_keydb_update_keyblock (ctrl_t ctrl,
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. */