X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d47c009c2afd20b86cca083787d238c136e70abd..8c682e4ffcd8fdf9bcaf8f062f1d0a6517ea9e5d:/sdk/go/keepclient/hashcheck.go diff --git a/sdk/go/keepclient/hashcheck.go b/sdk/go/keepclient/hashcheck.go index a585d00888..1f696d95b6 100644 --- a/sdk/go/keepclient/hashcheck.go +++ b/sdk/go/keepclient/hashcheck.go @@ -30,9 +30,10 @@ type HashCheckingReader struct { // the checksum doesn't match. func (this HashCheckingReader) Read(p []byte) (n int, err error) { n, err = this.Reader.Read(p) - if err == nil { + if n > 0 { this.Hash.Write(p[:n]) - } else if err == io.EOF { + } + if err == io.EOF { sum := this.Hash.Sum(make([]byte, 0, this.Hash.Size())) if fmt.Sprintf("%x", sum) != this.Check { err = BadChecksum