From 4b8369c071f21fc8c43d92fe6d8d255df2ae1b9a Mon Sep 17 00:00:00 2001 From: vyzo Date: Sun, 30 Jan 2022 15:11:18 +0200 Subject: [PATCH] fix buffered reads --- blockstore/splitstore/checkpoint.go | 2 +- blockstore/splitstore/markset_map.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blockstore/splitstore/checkpoint.go b/blockstore/splitstore/checkpoint.go index 68afeb3da..d3cd4cba7 100644 --- a/blockstore/splitstore/checkpoint.go +++ b/blockstore/splitstore/checkpoint.go @@ -90,7 +90,7 @@ func readRawCid(buf *bufio.Reader, hbuf []byte) (cid.Cid, error) { hbuf = hbuf[:int(sz)] } - if _, err := buf.Read(hbuf); err != nil { + if _, err := io.ReadFull(buf, hbuf); err != nil { return cid.Undef, xerrors.Errorf("error reading hash: %w", err) // wrap EOF, it's corrupt } diff --git a/blockstore/splitstore/markset_map.go b/blockstore/splitstore/markset_map.go index 8b088e70a..38cea1288 100644 --- a/blockstore/splitstore/markset_map.go +++ b/blockstore/splitstore/markset_map.go @@ -71,7 +71,7 @@ func (e *MapMarkSetEnv) Recover(name string) (MarkSet, error) { } key := make([]byte, int(sz)) - if _, err = buf.Read(key); err != nil { + if _, err = io.ReadFull(buf, key); err != nil { break }