diff options
| author | NIIBE Yutaka <[email protected]> | 2025-10-22 01:52:52 +0000 |
|---|---|---|
| committer | NIIBE Yutaka <[email protected]> | 2025-10-22 01:52:52 +0000 |
| commit | 4a2dda2002c42fa541dacd142093c89476df606d (patch) | |
| tree | 2d16bc08c7bf4135536e5ae1fb8c33bb5fa66b94 /kbx/keybox-update.c | |
| parent | gpg,gpgsm: No more internal-lock when KEEP_LOCK is enabled. (diff) | |
| download | gnupg-4a2dda2002c42fa541dacd142093c89476df606d.tar.gz gnupg-4a2dda2002c42fa541dacd142093c89476df606d.zip | |
kbx,gpg,gpgsm: Add FP-close method for keydb to close before unlock.
* kbx/keybox.h (keybox_fp_close): New.
* kbx/keybox-init.c (keybox_fp_close): New.
(keybox_release): Don't close FP here.
* kbx/keybox-update.c (keybox_compress_when_no_other_users): Use
keybox_fp_close.
* kbx/backend-kbx.c (be_kbx_release_kbx_hd): Follow the change.
* g10/keyring.h (keyring_fp_close): New.
* g10/keyring.c (keyring_fp_close): New.
(keyring_release): Don't close IOBUF here.
(keyring_rebuild_cache): Use keyring_fp_close.
* g10/keydb.c (do_fp_close): New.
(unlock_all): Close FP before unlocking.
* sm/keydb.c (do_fp_close): New.
(unlock_all): Close FP before unlocking.
--
GnuPG-bug-id: 7855
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'kbx/keybox-update.c')
| -rw-r--r-- | kbx/keybox-update.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kbx/keybox-update.c b/kbx/keybox-update.c index a712a6bf2..f037485da 100644 --- a/kbx/keybox-update.c +++ b/kbx/keybox-update.c @@ -654,12 +654,14 @@ keybox_compress_when_no_other_users (void *token, int for_openpgp) fname = hd->kb->fname; if (!fname) { + keybox_fp_close (hd); keybox_release (hd); return; } if (keybox_lock (hd, 1, 0)) { + keybox_fp_close (hd); keybox_release (hd); return; } @@ -828,8 +830,7 @@ keybox_compress_when_no_other_users (void *token, int for_openpgp) fname, gpg_strerror (err)); leave: - /* Here, we unlock before the release of HD. It's safe because - references to the resource are all closed. */ + keybox_fp_close (hd); keybox_lock (hd, 0, 0); keybox_release (hd); return; |
