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:
Rob Pike 2009-11-19 11:51:23 -08:00
parent 4aaf948f90
commit 4e201c7f20

View File

@ -138,6 +138,9 @@ func (file *File) ReadAt(b []byte, off int64) (n int, err Error) {
}
for len(b) > 0 {
m, e := syscall.Pread(file.fd, b, off);
if m == 0 && e == 0 {
return n, EOF
}
n += m;
if e != 0 {
err = &PathError{"read", file.name, Errno(e)};