From 5d6fa7b886cf7178d689430617506a1d852f2af5 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Sat, 14 Jan 2017 21:43:31 +0800 Subject: [PATCH] Fix go vet errors Signed-off-by: Qiang Huang --- cmd/containerd-shim/main.go | 25 ++++++++++++------------- cmd/containerd-shim/process.go | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cmd/containerd-shim/main.go b/cmd/containerd-shim/main.go index 34245ad..1c82f50 100644 --- a/cmd/containerd-shim/main.go +++ b/cmd/containerd-shim/main.go @@ -108,7 +108,7 @@ func start(log *os.File) error { return nil } var exitShim bool - for { + for !exitShim { select { case s := <-signals: switch s { @@ -122,18 +122,6 @@ func start(log *os.File) error { } } } - // runtime has exited so the shim can also exit - if exitShim { - // kill all processes in the container incase it was not running in - // its own PID namespace - p.killAll() - // wait for all the processes and IO to finish - p.Wait() - // delete the container from the runtime - p.delete() - // the close of the exit fifo will happen when the shim exits - return nil - } case msg := <-msgC: switch msg.Type { case 0: @@ -153,6 +141,17 @@ func start(log *os.File) error { } } } + + // runtime has exited so the shim can also exit + + // kill all processes in the container incase it was not running in + // its own PID namespace + p.killAll() + // wait for all the processes and IO to finish + p.Wait() + // delete the container from the runtime + p.delete() + // the close of the exit fifo will happen when the shim exits return nil } diff --git a/cmd/containerd-shim/process.go b/cmd/containerd-shim/process.go index a334aa1..086d623 100644 --- a/cmd/containerd-shim/process.go +++ b/cmd/containerd-shim/process.go @@ -36,7 +36,7 @@ type checkpoint struct { } type processState struct { - Terminal bool `json:terminal` + Terminal bool `json:"terminal"` Exec bool `json:"exec"` Stdin string `json:"containerdStdin"` Stdout string `json:"containerdStdout"`