mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
g10: If iobuf_seek fails when reading from the cache, do a hard read.
* g10/keydb.c (keydb_get_keyblock): If the iobuf_seek fails when reading from the cache, then simply clear the cache and try reading from the database. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>.
This commit is contained in:
parent
219de84df9
commit
f076fa190e
10
g10/keydb.c
10
g10/keydb.c
@ -1126,7 +1126,14 @@ keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb)
|
||||
|
||||
if (keyblock_cache.state == KEYBLOCK_CACHE_FILLED)
|
||||
{
|
||||
iobuf_seek (keyblock_cache.iobuf, 0);
|
||||
err = iobuf_seek (keyblock_cache.iobuf, 0);
|
||||
if (err)
|
||||
{
|
||||
log_error ("keydb_get_keyblock: failed to rewind iobuf for cache\n");
|
||||
keyblock_cache_clear ();
|
||||
}
|
||||
else
|
||||
{
|
||||
err = parse_keyblock_image (keyblock_cache.iobuf,
|
||||
keyblock_cache.pk_no,
|
||||
keyblock_cache.uid_no,
|
||||
@ -1139,6 +1146,7 @@ keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb)
|
||||
: "keydb_get_keyblock leave (cached)");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (hd->found < 0 || hd->found >= hd->used)
|
||||
return gpg_error (GPG_ERR_VALUE_NOT_FOUND);
|
||||
|
Loading…
x
Reference in New Issue
Block a user