aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--s3/file.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/s3/file.go b/s3/file.go
index 3d59aa2..b20d247 100644
--- a/s3/file.go
+++ b/s3/file.go
@@ -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) {