From 9288ac511793de8edb9fcb12c758917a867af118 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Mon, 4 Apr 2016 13:05:02 -0700 Subject: [PATCH] Seeking to offset while doing readAt with non-zero offset --- client/allocdir/alloc_dir.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/allocdir/alloc_dir.go b/client/allocdir/alloc_dir.go index 81528fcff..4ba84f112 100644 --- a/client/allocdir/alloc_dir.go +++ b/client/allocdir/alloc_dir.go @@ -331,6 +331,9 @@ func (d *AllocDir) ReadAt(path string, offset int64, limit int64) (io.ReadCloser if err != nil { return nil, err } + if _, err := f.Seek(offset, 0); err != nil { + return nil, fmt.Errorf("can't seek to offset %q: %v", offset, err) + } return &ReadCloserWrapper{Reader: io.LimitReader(f, limit), Closer: f}, nil }