panic during start of failed detached container

Signed-off-by: rajasec <rajasec79@gmail.com>

Adding nil check before closing tty for restore operation

Signed-off-by: rajasec <rajasec79@gmail.com>
This commit is contained in:
rajasec
2016-02-14 18:53:02 +05:30
parent 361f9b7921
commit 321b842404
2 changed files with 12 additions and 4 deletions
+6 -2
View File
@@ -135,14 +135,18 @@ func restoreContainer(context *cli.Context, spec *specs.LinuxSpec, config *confi
return -1, err
}
if err := container.Restore(process, options); err != nil {
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
if pidFile := context.String("pid-file"); pidFile != "" {
if err := createPidFile(pidFile, process); err != nil {
process.Signal(syscall.SIGKILL)
process.Wait()
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
}
+6 -2
View File
@@ -308,7 +308,9 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
}
if err := container.Start(process); err != nil {
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
@@ -316,7 +318,9 @@ func runProcess(container libcontainer.Container, config *specs.Process, listenF
if err := createPidFile(pidFile, process); err != nil {
process.Signal(syscall.SIGKILL)
process.Wait()
tty.Close()
if tty != nil {
tty.Close()
}
return -1, err
}
}