os: add a few upstream tests for Read and ReadAt, fix problems they exposed.

There are more upstream tests to pull in, but this is plenty for today.
This commit is contained in:
Dan Kegel
2021-12-29 09:36:01 -08:00
committed by Ron Evans
parent 1e2791b216
commit 61be9189f1
4 changed files with 148 additions and 4 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ type unixFileHandle uintptr
func (f unixFileHandle) Read(b []byte) (n int, err error) {
n, err = syscall.Read(syscallFd(f), b)
err = handleSyscallError(err)
if n == 0 && err == nil {
if n == 0 && len(b) > 0 && err == nil {
err = io.EOF
}
return