mirror of
https://github.com/containers/podman.git
synced 2025-05-22 17:46:52 +08:00
remove temporary files when copy
[NO NEW TESTS NEEDED] Fixes: #19496 Signed-off-by: binghongtao <695097494plus@gmail.com>
This commit is contained in:
@ -382,6 +382,8 @@ func copyToContainer(container string, containerPath string, hostPath string) er
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer os.Remove(tmpFile.Name())
|
||||||
|
|
||||||
_, err = io.Copy(tmpFile, os.Stdin)
|
_, err = io.Copy(tmpFile, os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -389,6 +391,7 @@ func copyToContainer(container string, containerPath string, hostPath string) er
|
|||||||
if err = tmpFile.Close(); err != nil {
|
if err = tmpFile.Close(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !archive.IsArchivePath(tmpFile.Name()) {
|
if !archive.IsArchivePath(tmpFile.Name()) {
|
||||||
return errors.New("source must be a (compressed) tar archive when copying from stdin")
|
return errors.New("source must be a (compressed) tar archive when copying from stdin")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user