mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
sm: Change keydb code to use the keybox locking.
* kbx/keybox-init.c (keybox_lock): New arg TIMEOUT. Change all callers to pass -1 when locking. * sm/keydb.c (struct resource_item): Remove LOCKANDLE. (struct keydb_handle): Add KEEP_LOCK. (keydb_add_resource): Use keybox locking instead of a separate dotlock for testing whether we can run a compress. (keydb_release): Reset KEEP_LOCK. (keydb_lock): Set KEEP_LOCK. (unlock_all): Take care of KEEP_LOCK. (lock_all): Use keybox_lock instead of dotlock fucntions. (keydb_delete): Remove arg UNLOCK. * sm/delete.c (delete_one): Adjust keydb_delete. Due to the KEEP_LOCK the keydb_release takes care of unlocking. -- This aligns the code more with g10/keydb.c and avoids the separate calls to dotlock_take. GnuPG-bug-id: 4505 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
54e96c6fd2
commit
22e274f839
6 changed files with 53 additions and 49 deletions
|
@ -113,7 +113,8 @@ delete_one (ctrl_t ctrl, const char *username)
|
|||
goto leave;
|
||||
}
|
||||
|
||||
/* We need to search again to get back to the right position. */
|
||||
/* We need to search again to get back to the right position. Neo
|
||||
* that the lock is kept until the KH is released. */
|
||||
rc = keydb_lock (kh);
|
||||
if (rc)
|
||||
{
|
||||
|
@ -132,7 +133,7 @@ delete_one (ctrl_t ctrl, const char *username)
|
|||
goto leave;
|
||||
}
|
||||
|
||||
rc = keydb_delete (kh, duplicates ? 0 : 1);
|
||||
rc = keydb_delete (kh);
|
||||
if (rc)
|
||||
goto leave;
|
||||
if (opt.verbose)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue