mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01: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
32476f870d
commit
a698adbb53
@ -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…
Reference in New Issue
Block a user