Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Fix EOF indication from Readdir
Browse files Browse the repository at this point in the history
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 <jonathan@titanous.com>
  • Loading branch information
titanous committed Jul 4, 2017
1 parent d628573 commit a2015b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions readdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ func (rd *Readdir) Read(ctx context.Context, p []byte, offset int64) (n int, err
}

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

Expand Down

0 comments on commit a2015b1

Please sign in to comment.