1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Ensure that the container dir is remove on restore

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-02-27 08:28:02 -08:00
parent fb08b8b221
commit a115ce797b

View file

@ -108,20 +108,18 @@ func (d *driver) Kill(p *execdriver.Command, sig int) error {
}
func (d *driver) Restore(c *execdriver.Command) error {
var (
nspid int
path = filepath.Join(d.root, c.ID, "pid")
)
f, err := os.Open(path)
var nspid int
f, err := os.Open(filepath.Join(d.root, c.ID, "pid"))
if err != nil {
return err
}
defer d.removeContainerRoot(c.ID)
if _, err := fmt.Fscanf(f, "%d", &nspid); err != nil {
f.Close()
return err
}
f.Close()
defer os.Remove(path)
proc, err := os.FindProcess(nspid)
if err != nil {