Fix truncated data

This commit is contained in:
MoZhonghua 2016-06-24 10:54:53 +08:00
parent 9ec1b936e5
commit 0efdb40d57

View File

@ -107,6 +107,13 @@ func (this *Reader) Read(p []byte) (n int, err error) {
if err != syscall.E2BIG || bytesWritten == 0 {
// track anything else
this.err = err
} else {
// Should not return this.err
// If we got EOF from source in last fillBuffer() call, and
// there is still more data to process in buffer, in this
// case, if we return this.err(=EOF), then data in buffer
// will be lost.
return n, nil
}
}