]> Cypherpunks repositories - gostls13.git/commitdiff
os.ReadAt doesn't return EOF at EOF.
authorRob Pike <r@golang.org>
Thu, 19 Nov 2009 19:51:23 +0000 (11:51 -0800)
committerRob Pike <r@golang.org>
Thu, 19 Nov 2009 19:51:23 +0000 (11:51 -0800)
thanks to lionkov for the fix.

Fixes #262.

R=rsc
CC=golang-dev
https://golang.org/cl/156097

src/pkg/os/file.go

index edc228c53bba72734e931f7bf0b796beb818e664..bc7f02ef98460f243dde567db5303a7bb3956ea8 100644 (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)};