mirror of
https://github.com/golang/go
synced 2024-11-26 01:17:57 -07:00
os.ReadAt doesn't return EOF at EOF.
thanks to lionkov for the fix. Fixes #262. R=rsc CC=golang-dev https://golang.org/cl/156097
This commit is contained in:
parent
4aaf948f90
commit
4e201c7f20
@ -138,6 +138,9 @@ func (file *File) ReadAt(b []byte, off int64) (n int, err Error) {
|
|||||||
}
|
}
|
||||||
for len(b) > 0 {
|
for len(b) > 0 {
|
||||||
m, e := syscall.Pread(file.fd, b, off);
|
m, e := syscall.Pread(file.fd, b, off);
|
||||||
|
if m == 0 && e == 0 {
|
||||||
|
return n, EOF
|
||||||
|
}
|
||||||
n += m;
|
n += m;
|
||||||
if e != 0 {
|
if e != 0 {
|
||||||
err = &PathError{"read", file.name, Errno(e)};
|
err = &PathError{"read", file.name, Errno(e)};
|
||||||
|
Loading…
Reference in New Issue
Block a user