Filter out EOF errors in ReadFile.

geesefs-0-30-9
Aaron Jacobs 2015-03-05 19:58:20 -06:00
parent bf0b773894
commit f412eaa60a
2 changed files with 8 additions and 1 deletions

View File

@ -694,7 +694,8 @@ type ReadFileRequest struct {
}
type ReadFileResponse struct {
// The data read.
// The data read. If this is less than the requested size, it indicates EOF.
// An error should not be returned in this case.
Data []byte
}

View File

@ -16,6 +16,7 @@ package memfs
import (
"fmt"
"io"
"os"
"time"
@ -497,6 +498,11 @@ func (fs *memFS) ReadFile(
n, err := inode.ReadAt(resp.Data, req.Offset)
resp.Data = resp.Data[:n]
// Don't return EOF errors; we just indicate EOF to fuse using a short read.
if err == io.EOF {
err = nil
}
return
}