1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

fd leak and error handling

Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
This commit is contained in:
Deng Guangxing 2017-06-20 11:56:25 +08:00
parent db57b85fcb
commit 0042f992d8
2 changed files with 7 additions and 2 deletions

View file

@ -46,7 +46,9 @@ func (r *multiReadSeeker) Seek(offset int64, whence int) (int64, error) {
rdrOffset := offset - tmpOffset
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
for _, rdr := range r.readers[i+1:] {
rdr.Seek(0, os.SEEK_SET)
@ -67,7 +69,9 @@ func (r *multiReadSeeker) Seek(offset int64, whence int) (int64, error) {
}
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
case os.SEEK_CUR:
if r.pos == nil {

View file

@ -226,6 +226,7 @@ func (fms *fileMetadataStore) TarSplitReader(layer ChainID) (io.ReadCloser, erro
}
f, err := gzip.NewReader(fz)
if err != nil {
fz.Close()
return nil, err
}