diff options
Diffstat (limited to 's3/file.go')
-rw-r--r-- | s3/file.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -86,7 +86,10 @@ func (f *S3File) Read(p []byte) (n int, err error) { } func (f *S3File) ReadAt(p []byte, off int64) (n int, err error) { - if f.eof { + stat, err := f.Stat() + if err != nil { + return 0, err + } else if off >= stat.Size() { return 0, io.EOF } @@ -95,10 +98,7 @@ func (f *S3File) ReadAt(p []byte, off int64) (n int, err error) { return 0, err } - n, err = f.obj.ReadAt(p, off) - f.eof = err == io.EOF - - return + return f.obj.ReadAt(p, off) } func (f *S3File) WriteAt(p []byte, off int64) (n int, err error) { |