aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/filehandle_read.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/mount/filehandle_read.go')
-rw-r--r--weed/mount/filehandle_read.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/mount/filehandle_read.go b/weed/mount/filehandle_read.go
index 3c315b1c4..faf99952f 100644
--- a/weed/mount/filehandle_read.go
+++ b/weed/mount/filehandle_read.go
@@ -47,6 +47,9 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, int64, e
if fileSize == 0 {
glog.V(1).Infof("empty fh %v", fileFullPath)
return 0, 0, io.EOF
+ } else if offset >= fileSize {
+ glog.V(1).Infof("invalid read, fileSize %d, offset %d for %s", fileSize, offset, fileFullPath)
+ return 0, 0, io.EOF
}
if offset < int64(len(entry.Content)) {
@@ -66,7 +69,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, int64, e
return int64(totalRead), ts, err
}
-func (fh *FileHandle) downloadRemoteEntry(entry *LockedEntry) (error) {
+func (fh *FileHandle) downloadRemoteEntry(entry *LockedEntry) error {
fileFullPath := fh.FullPath()
dir, _ := fileFullPath.DirAndName()