Merge pull request #8063 from jlhawn/tarsum_empty_tar_archive
tarsum: correct close and finish reads
This commit is contained in:
commit
e32fdc563a
2 changed files with 80 additions and 0 deletions
|
@ -162,6 +162,12 @@ func (ts *tarSum) Read(buf []byte) (int, error) {
|
|||
currentHeader, err := ts.tarR.Next()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
if err := ts.tarW.Close(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if _, err := io.Copy(ts.gz, ts.bufTar); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if err := ts.gz.Close(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue