mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +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 {
|
||||
return err
|
||||
}
|
||||
defer os.Remove(tmpFile.Name())
|
||||
|
||||
_, err = io.Copy(tmpFile, os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -389,6 +391,7 @@ func copyToContainer(container string, containerPath string, hostPath string) er
|
||||
if err = tmpFile.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !archive.IsArchivePath(tmpFile.Name()) {
|
||||
return errors.New("source must be a (compressed) tar archive when copying from stdin")
|
||||
}
|
||||
|
Reference in New Issue
Block a user