aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keydb.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2023-12-29 01:57:26 +0000
committerNIIBE Yutaka <[email protected]>2023-12-29 01:57:26 +0000
commit591a53d716aab90e0b9573ce4a993e4577486e3f (patch)
tree8c4d5f6f230fa3ac9411506c3af6cb296cb405b2 /g10/keydb.c
parenttools: Fix argparse table of gpgconf. (diff)
downloadgnupg-591a53d716aab90e0b9573ce4a993e4577486e3f.tar.gz
gnupg-591a53d716aab90e0b9573ce4a993e4577486e3f.zip
gpg: Don't call keybox_compress when KEYDB_RESOURCE_FLAG_READONLY.
* g10/keydb.c (keydb_add_resource): Check the FLAGS to call keybox_compress. -- GnuPG-bug-id: 6811 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10/keydb.c')
-rw-r--r--g10/keydb.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/g10/keydb.c b/g10/keydb.c
index d2d085291..ba61f8290 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -746,28 +746,30 @@ keydb_add_resource (const char *url, unsigned int flags)
err = gpg_error (GPG_ERR_RESOURCE_LIMIT);
else
{
- KEYBOX_HANDLE kbxhd;
-
if ((flags & KEYDB_RESOURCE_FLAG_PRIMARY))
primary_keydb = token;
all_resources[used_resources].type = rt;
all_resources[used_resources].u.kb = NULL; /* Not used here */
all_resources[used_resources].token = token;
- /* Do a compress run if needed and no other user is
- * currently using the keybox. */
- kbxhd = keybox_new_openpgp (token, 0);
- if (kbxhd)
+ if (!(flags & KEYDB_RESOURCE_FLAG_READONLY))
{
- if (!keybox_lock (kbxhd, 1, 0))
+ 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)
{
- keybox_compress (kbxhd);
- keybox_lock (kbxhd, 0, 0);
- }
+ if (!keybox_lock (kbxhd, 1, 0))
+ {
+ keybox_compress (kbxhd);
+ keybox_lock (kbxhd, 0, 0);
+ }
- keybox_release (kbxhd);
+ keybox_release (kbxhd);
+ }
}
-
used_resources++;
}
}