diff options
author | Niibe Yutaka <[email protected]> | 2016-06-14 23:41:56 +0000 |
---|---|---|
committer | Niibe Yutaka <[email protected]> | 2016-06-14 23:49:50 +0000 |
commit | 35a3ce2acf78a95fecbccfd8db0560cca24232df (patch) | |
tree | 6ab96afe1153a0f7b5ef09324dda07eb65a47042 | |
parent | gpg: Print the subkey's curve and not the primary key curve. (diff) | |
download | gnupg-35a3ce2acf78a95fecbccfd8db0560cca24232df.tar.gz gnupg-35a3ce2acf78a95fecbccfd8db0560cca24232df.zip |
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 for a reproducible script and patience.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | g10/tdbio.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/g10/tdbio.c b/g10/tdbio.c index a4147090c..e27788e84 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -119,6 +119,7 @@ static int in_transaction; static void open_db (void); +static void create_hashtable (TRUSTREC *vr, int type); @@ -582,8 +583,13 @@ create_version_record (void) rec.rectype = RECTYPE_VER; rec.recnum = 0; rc = tdbio_write_record (&rec); + if (!rc) tdbio_sync (); + + if (!rc) + create_hashtable (&rec, 0); + return rc; } @@ -957,8 +963,6 @@ get_trusthashrec(void) if (rc) log_fatal (_("%s: error reading version record: %s\n"), db_name, gpg_strerror (rc) ); - if (!vr.r.ver.trusthashtbl) - create_hashtable (&vr, 0); trusthashtbl = vr.r.ver.trusthashtbl; } |