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
30
g10/keydb.c
30
g10/keydb.c
@ -1126,18 +1126,26 @@ keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb)
|
|||||||
|
|
||||||
if (keyblock_cache.state == KEYBLOCK_CACHE_FILLED)
|
if (keyblock_cache.state == KEYBLOCK_CACHE_FILLED)
|
||||||
{
|
{
|
||||||
iobuf_seek (keyblock_cache.iobuf, 0);
|
err = iobuf_seek (keyblock_cache.iobuf, 0);
|
||||||
err = parse_keyblock_image (keyblock_cache.iobuf,
|
|
||||||
keyblock_cache.pk_no,
|
|
||||||
keyblock_cache.uid_no,
|
|
||||||
keyblock_cache.sigstatus,
|
|
||||||
ret_kb);
|
|
||||||
if (err)
|
if (err)
|
||||||
keyblock_cache_clear ();
|
{
|
||||||
if (DBG_CLOCK)
|
log_error ("keydb_get_keyblock: failed to rewind iobuf for cache\n");
|
||||||
log_clock (err? "keydb_get_keyblock leave (cached, failed)"
|
keyblock_cache_clear ();
|
||||||
: "keydb_get_keyblock leave (cached)");
|
}
|
||||||
return err;
|
else
|
||||||
|
{
|
||||||
|
err = parse_keyblock_image (keyblock_cache.iobuf,
|
||||||
|
keyblock_cache.pk_no,
|
||||||
|
keyblock_cache.uid_no,
|
||||||
|
keyblock_cache.sigstatus,
|
||||||
|
ret_kb);
|
||||||
|
if (err)
|
||||||
|
keyblock_cache_clear ();
|
||||||
|
if (DBG_CLOCK)
|
||||||
|
log_clock (err? "keydb_get_keyblock leave (cached, failed)"
|
||||||
|
: "keydb_get_keyblock leave (cached)");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hd->found < 0 || hd->found >= hd->used)
|
if (hd->found < 0 || hd->found >= hd->used)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user