Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Commit

Permalink
lazyfs: fix EIO on EOF
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Jul 28, 2017
1 parent 920f6e4 commit b33bc29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lazyfs/lazyfile.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package lazyfs

import (
"io"

"github.com/Sirupsen/logrus"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
Expand Down Expand Up @@ -42,7 +44,9 @@ func (f *file) Read(buf []byte, off int64) (res fuse.ReadResult, code fuse.Statu
logrus.Errorf("error while seeking %s to %d: %v", dgst, off, err)
return nil, fuse.EIO
}
if _, err := br.Read(buf); err != nil {
if n, err := br.Read(buf); err == io.EOF {
buf = buf[:n]
} else if err != nil {
logrus.Errorf("error while reading %d bytes at %d for %s: %v",
len(buf), off, dgst, err)
return nil, fuse.EIO
Expand Down

0 comments on commit b33bc29

Please sign in to comment.