mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
g10: Fix another race condition for trustdb access.
* g10/tdbio.c (create_version_record): Call create_hashtable to always
make hashtable, together with the version record.
(get_trusthashrec): Remove call to create_hashtable.
--
GnuPG-bug-id: 1675
Thanks to Scott Moser to reproducible script and patience.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(backport from master
commit 35a3ce2acf
)
This commit is contained in:
parent
536c721183
commit
db246f8b18
61 changed files with 165851 additions and 2 deletions
|
@ -93,6 +93,7 @@ static int in_transaction;
|
|||
|
||||
static void open_db(void);
|
||||
static void migrate_from_v2 (void);
|
||||
static void create_hashtable (TRUSTREC *vr, int type);
|
||||
|
||||
static int
|
||||
take_write_lock (void)
|
||||
|
@ -469,6 +470,10 @@ create_version_record (void)
|
|||
rc = tdbio_write_record( &rec );
|
||||
if( !rc )
|
||||
tdbio_sync();
|
||||
|
||||
if (!rc)
|
||||
create_hashtable (&rec, 0);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -760,8 +765,6 @@ get_trusthashrec(void)
|
|||
if( rc )
|
||||
log_fatal( _("%s: error reading version record: %s\n"),
|
||||
db_name, g10_errstr(rc) );
|
||||
if( !vr.r.ver.trusthashtbl )
|
||||
create_hashtable( &vr, 0 );
|
||||
|
||||
trusthashtbl = vr.r.ver.trusthashtbl;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue