mirror of https://github.com/containers/podman.git
Merge pull request #19526 from HirazawaUi/fix-not-remove-tempfile
remove temporary files when copy
This commit is contained in:
commit
c3cab72065
|
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue