mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
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:
+6
-2
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user