mirror of
https://github.com/restic/restic.git
synced 2025-08-23 17:55:17 +00:00
local/sftp backend: Do not seek if offset is 0
This commit is contained in:
@@ -223,10 +223,12 @@ func (b *Local) GetReader(t backend.Type, name string, offset, length uint) (io.
|
||||
b.open[filename(b.p, t, name)] = append(open, f)
|
||||
b.mu.Unlock()
|
||||
|
||||
if offset > 0 {
|
||||
_, err = f.Seek(int64(offset), 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if length == 0 {
|
||||
return f, nil
|
||||
|
@@ -336,10 +336,12 @@ func (r *SFTP) GetReader(t backend.Type, name string, offset, length uint) (io.R
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if offset > 0 {
|
||||
_, err = f.Seek(int64(offset), 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if length == 0 {
|
||||
return f, nil
|
||||
|
Reference in New Issue
Block a user