mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01: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 35a3ce2acf78a95fecbccfd8db0560cca24232df)
This commit is contained in:
parent
d8775285e9
commit
00d737e3fd
@ -92,6 +92,7 @@ static int db_fd = -1;
|
||||
static int in_transaction;
|
||||
|
||||
static void open_db(void);
|
||||
static void create_hashtable (TRUSTREC *vr, int type);
|
||||
|
||||
static int
|
||||
take_write_lock (void)
|
||||
@ -471,6 +472,10 @@ create_version_record (void)
|
||||
rc = tdbio_write_record( &rec );
|
||||
if( !rc )
|
||||
tdbio_sync();
|
||||
|
||||
if (!rc)
|
||||
create_hashtable (&rec, 0);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -763,8 +768,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…
x
Reference in New Issue
Block a user