mirror of https://github.com/spf13/afero.git
report io.EOF in Read() to caller
This commit is contained in:
parent
4dfd3d7373
commit
0d31cf4b25
6
union.go
6
union.go
|
@ -103,7 +103,11 @@ func (f *UnionFile) Read(s []byte) (int, error) {
|
|||
if (err == nil || err == io.EOF) && f.base != nil {
|
||||
// advance the file position also in the base file, the next
|
||||
// call may be a write at this position (or a seek with SEEK_CUR)
|
||||
_, err = f.base.Seek(int64(n), os.SEEK_CUR)
|
||||
if _, seekErr := f.base.Seek(int64(n), os.SEEK_CUR); serr != nil {
|
||||
// only overwrite err in case the seek fails: we need to
|
||||
// report an eventual io.EOF to the caller
|
||||
err = seekErr
|
||||
}
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue