mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #33713 from x1022as/error_fd
fd leak and error handling
This commit is contained in:
commit
3be2273d03
2 changed files with 7 additions and 2 deletions
|
@ -46,7 +46,9 @@ func (r *multiReadSeeker) Seek(offset int64, whence int) (int64, error) {
|
||||||
rdrOffset := offset - tmpOffset
|
rdrOffset := offset - tmpOffset
|
||||||
idx := i
|
idx := i
|
||||||
|
|
||||||
rdr.Seek(rdrOffset, os.SEEK_SET)
|
if _, err := rdr.Seek(rdrOffset, os.SEEK_SET); err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
// make sure all following readers are at 0
|
// make sure all following readers are at 0
|
||||||
for _, rdr := range r.readers[i+1:] {
|
for _, rdr := range r.readers[i+1:] {
|
||||||
rdr.Seek(0, os.SEEK_SET)
|
rdr.Seek(0, os.SEEK_SET)
|
||||||
|
@ -67,7 +69,9 @@ func (r *multiReadSeeker) Seek(offset int64, whence int) (int64, error) {
|
||||||
}
|
}
|
||||||
tmpOffset += s
|
tmpOffset += s
|
||||||
}
|
}
|
||||||
r.Seek(tmpOffset+offset, os.SEEK_SET)
|
if _, err := r.Seek(tmpOffset+offset, os.SEEK_SET); err != nil {
|
||||||
|
return -1, err
|
||||||
|
}
|
||||||
return tmpOffset + offset, nil
|
return tmpOffset + offset, nil
|
||||||
case os.SEEK_CUR:
|
case os.SEEK_CUR:
|
||||||
if r.pos == nil {
|
if r.pos == nil {
|
||||||
|
|
|
@ -226,6 +226,7 @@ func (fms *fileMetadataStore) TarSplitReader(layer ChainID) (io.ReadCloser, erro
|
||||||
}
|
}
|
||||||
f, err := gzip.NewReader(fz)
|
f, err := gzip.NewReader(fz)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fz.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue