mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 00:15:44 +00:00
checkpoint: close rootfs tar stream after use
chrootarchive.Tar returns an io.ReadCloser backed by a pipe to the tar-producing process. CRCreateRootFsDiffTar copies from the stream but never closes it. On the successful path the stream is read to EOF, so the producer normally exits. On early errors, such as failing to create the destination file or failing while copying to it, the producer can be left without a consumer. Close the tar stream after it is created so error paths release the pipe and allow the producer to exit. Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko00@bk.ru>
This commit is contained in:
parent
1479c7d6b6
commit
feff567126
1 changed files with 1 additions and 0 deletions
|
|
@ -166,6 +166,7 @@ func CRCreateRootFsDiffTar(changes *[]archive.Change, mountPoint, destination st
|
|||
if err != nil {
|
||||
return includeFiles, fmt.Errorf("exporting root file-system diff to %q: %w", rootfsDiffPath, err)
|
||||
}
|
||||
defer rootfsTar.Close()
|
||||
rootfsDiffFile, err := os.Create(rootfsDiffPath)
|
||||
if err != nil {
|
||||
return includeFiles, fmt.Errorf("creating root file-system diff file %q: %w", rootfsDiffPath, err)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue