Merge pull request #1030 from hashicorp/b-readat

Seeking to offset while doing readAt with non-zero offset
This commit is contained in:
Diptanu Choudhury 2016-04-04 13:28:12 -07:00
commit 04f890d695

View file

@ -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
}