mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
kbx: Fix a race condition on DATABASE_HD.
* kbx/backend-sqlite.c (create_or_open_database): Protect the access to DATABASE_HD. -- GnuPG-bug-id: 7294 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
fc30f70596
commit
b804378f18
1 changed files with 6 additions and 3 deletions
|
@ -568,11 +568,14 @@ create_or_open_database (ctrl_t ctrl, const char *filename)
|
|||
int dbversion;
|
||||
int setdbversion = 0;
|
||||
|
||||
if (database_hd)
|
||||
return 0; /* Already initialized. */
|
||||
|
||||
acquire_mutex ();
|
||||
|
||||
if (database_hd)
|
||||
{
|
||||
release_mutex ();
|
||||
return 0; /* Already initialized. */
|
||||
}
|
||||
|
||||
/* To avoid races with other temporary instances of keyboxd trying
|
||||
* to create or update the database, we run the database with a lock
|
||||
* file held. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue