aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keydb.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-10-22 01:41:34 +0000
committerNIIBE Yutaka <[email protected]>2025-10-22 01:41:34 +0000
commita0beed35d6c6be02414bb28fc7fa00758b8f5789 (patch)
tree572fc907c2dc0d8440e84d01dc392d8ecade8d61 /g10/keydb.c
parentpo: Update Japanese Translation. (diff)
downloadgnupg-a0beed35d6c6be02414bb28fc7fa00758b8f5789.tar.gz
gnupg-a0beed35d6c6be02414bb28fc7fa00758b8f5789.zip
kbx,gpg,gpgsm: Introduce keybox_compress_when_no_other_users.
* kbx/keybox.h (keybox_compress_when_no_other_users): Rename from keybox_compress, changing the arguments and the return type. * kbx/keybox-update.c (keybox_compress_when_no_other_users): Open the HD internally and make sure all resources are closed before unlocking. * g10/keydb.c (keydb_add_resource): Simply call keybox_compress_when_no_other_users which handles locking internally. * sm/keydb.c (keydb_add_resource): Likewise. -- GnuPG-bug-id: 7855 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10/keydb.c')
-rw-r--r--g10/keydb.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/g10/keydb.c b/g10/keydb.c
index f155d8e7a..3d95f511a 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -755,23 +755,9 @@ keydb_add_resource (const char *url, unsigned int flags)
all_resources[used_resources].token = token;
if (!(flags & KEYDB_RESOURCE_FLAG_READONLY))
- {
- KEYBOX_HANDLE kbxhd;
-
- /* Do a compress run if needed and no other user is
- * currently using the keybox. */
- kbxhd = keybox_new_openpgp (token, 0);
- if (kbxhd)
- {
- if (!keybox_lock (kbxhd, 1, 0))
- {
- keybox_compress (kbxhd);
- keybox_lock (kbxhd, 0, 0);
- }
-
- keybox_release (kbxhd);
- }
- }
+ /* Do a compress run if needed and no other user is
+ * currently using the keybox. */
+ keybox_compress_when_no_other_users (token, 1);
used_resources++;
}
}