Merge remote-tracking branch 'alexlarsson/fix-tar-leak' into dm-correct
This commit is contained in:
commit
c47e93fcbe
1 changed files with 11 additions and 1 deletions
12
archive.go
12
archive.go
|
@ -120,7 +120,8 @@ func TarFilter(path string, compression Compression, filter []string, recursive
|
||||||
tmpDir := ""
|
tmpDir := ""
|
||||||
|
|
||||||
if createFiles != nil {
|
if createFiles != nil {
|
||||||
tmpDir, err := ioutil.TempDir("", "docker-tar")
|
var err error // Can't use := here or we override the outer tmpDir
|
||||||
|
tmpDir, err = ioutil.TempDir("", "docker-tar")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -284,6 +285,9 @@ func CmdStream(cmd *exec.Cmd, input *string, atEnd func()) (io.Reader, error) {
|
||||||
if input != nil {
|
if input != nil {
|
||||||
stdin, err := cmd.StdinPipe()
|
stdin, err := cmd.StdinPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if atEnd != nil {
|
||||||
|
atEnd()
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// Write stdin if any
|
// Write stdin if any
|
||||||
|
@ -294,10 +298,16 @@ func CmdStream(cmd *exec.Cmd, input *string, atEnd func()) (io.Reader, error) {
|
||||||
}
|
}
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if atEnd != nil {
|
||||||
|
atEnd()
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
stderr, err := cmd.StderrPipe()
|
stderr, err := cmd.StderrPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if atEnd != nil {
|
||||||
|
atEnd()
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
pipeR, pipeW := io.Pipe()
|
pipeR, pipeW := io.Pipe()
|
||||||
|
|
Loading…
Add table
Reference in a new issue