Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit 33d1516

Browse files
committed
Fix EOF indication from Readdir
EOF is indicated by a zero-length result with no error, so ensure that io.EOF does not ever get returned by Readdir.Read. Signed-off-by: Jonathan Rudenberg <[email protected]>
1 parent 87ae851 commit 33d1516

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: readdir.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ func (rd *Readdir) Read(ctx context.Context, p []byte, offset int64) (n int, err
8282
}
8383

8484
done:
85-
if err == io.EOF && len(p) > 0 {
86-
// Don't let io.EOF escape if we've written to p. 9p doesn't handle
87-
// this like Go.
85+
if err == io.EOF {
86+
// Don't let io.EOF escape. EOF is indicated by a zero-length result
87+
// with no error.
8888
err = nil
8989
}
9090

0 commit comments

Comments
 (0)