mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
overlay2: close read end of pipe on mount exec
Use StdinPipe to ensure pipe is properly closed after startup Fixes #23686 Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
1c06ebeeee
commit
ad4b3e11fe
1 changed files with 4 additions and 7 deletions
|
@ -32,12 +32,6 @@ type mountOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func mountFrom(dir, device, target, mType, label string) error {
|
func mountFrom(dir, device, target, mType, label string) error {
|
||||||
|
|
||||||
r, w, err := os.Pipe()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("mountfrom pipe failure: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
options := &mountOptions{
|
options := &mountOptions{
|
||||||
Device: device,
|
Device: device,
|
||||||
Target: target,
|
Target: target,
|
||||||
|
@ -47,7 +41,10 @@ func mountFrom(dir, device, target, mType, label string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := reexec.Command("docker-mountfrom", dir)
|
cmd := reexec.Command("docker-mountfrom", dir)
|
||||||
cmd.Stdin = r
|
w, err := cmd.StdinPipe()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("mountfrom error on pipe creation: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
output := bytes.NewBuffer(nil)
|
output := bytes.NewBuffer(nil)
|
||||||
cmd.Stdout = output
|
cmd.Stdout = output
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue