fix buffered reads
This commit is contained in:
parent
72333147d3
commit
4b8369c071
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user