added write error handling
This commit is contained in:
parent
9af837a17c
commit
2e78593526
1 changed files with 8 additions and 2 deletions
|
|
@ -85,12 +85,18 @@ func (f *File) readWithoutCache(p []byte) (n int, err error) {
|
||||||
if f.offline {
|
if f.offline {
|
||||||
return 0, io.EOF
|
return 0, io.EOF
|
||||||
}
|
}
|
||||||
|
log := f.log
|
||||||
n, err = f.f.Read(p)
|
n, err = f.f.Read(p)
|
||||||
|
if n > 0 {
|
||||||
|
if n, err := f.md.WriteAt(p[:n], f.offset); err != nil {
|
||||||
|
log.Error(err, "error writing cache file")
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.log.Error(err, "error reading source file")
|
log.Error(err, "error reading source file")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f.md.WriteAt(p, f.offset)
|
|
||||||
f.md.AddChunk(f.offset, n)
|
f.md.AddChunk(f.offset, n)
|
||||||
f.offset += int64(n)
|
f.offset += int64(n)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue