mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +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
fc30f70596
commit
b804378f18
@ -568,11 +568,14 @@ create_or_open_database (ctrl_t ctrl, const char *filename)
|
|||||||
int dbversion;
|
int dbversion;
|
||||||
int setdbversion = 0;
|
int setdbversion = 0;
|
||||||
|
|
||||||
if (database_hd)
|
|
||||||
return 0; /* Already initialized. */
|
|
||||||
|
|
||||||
acquire_mutex ();
|
acquire_mutex ();
|
||||||
|
|
||||||
|
if (database_hd)
|
||||||
|
{
|
||||||
|
release_mutex ();
|
||||||
|
return 0; /* Already initialized. */
|
||||||
|
}
|
||||||
|
|
||||||
/* To avoid races with other temporary instances of keyboxd trying
|
/* To avoid races with other temporary instances of keyboxd trying
|
||||||
* to create or update the database, we run the database with a lock
|
* to create or update the database, we run the database with a lock
|
||||||
* file held. */
|
* file held. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user