mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #35589 from keloyang/close-fd
Close pipe in chrootarchive.invokeUnpack when cmd.Start()/json.NewEncoder failed
This commit is contained in:
commit
cefb33700c
1 changed files with 2 additions and 0 deletions
|
@ -66,10 +66,12 @@ func invokeUnpack(decompressedArchive io.Reader, dest string, options *archive.T
|
||||||
cmd.Stderr = output
|
cmd.Stderr = output
|
||||||
|
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
|
w.Close()
|
||||||
return fmt.Errorf("Untar error on re-exec cmd: %v", err)
|
return fmt.Errorf("Untar error on re-exec cmd: %v", err)
|
||||||
}
|
}
|
||||||
//write the options to the pipe for the untar exec to read
|
//write the options to the pipe for the untar exec to read
|
||||||
if err := json.NewEncoder(w).Encode(options); err != nil {
|
if err := json.NewEncoder(w).Encode(options); err != nil {
|
||||||
|
w.Close()
|
||||||
return fmt.Errorf("Untar json encode to pipe failed: %v", err)
|
return fmt.Errorf("Untar json encode to pipe failed: %v", err)
|
||||||
}
|
}
|
||||||
w.Close()
|
w.Close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue