Correct tarsum finish logic
Tarsum now correctly closes the internal TarWriter which appends a block of 1024 zeros to the end of the returned archive. Signed-off-by: Josh Hawn <josh.hawn@docker.com>
This commit is contained in:
parent
ed3d01687d
commit
96721b293c
2 changed files with 80 additions and 0 deletions
|
@ -148,6 +148,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