From ee9a53ca4b9cdb6b523e4aa2ae4bc1ca5713abd6 Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Mon, 18 Nov 2019 07:06:32 -0800 Subject: [PATCH] vc: Remove extra call to Kill Fixes #2207 Signed-off-by: Ted Yu --- virtcontainers/clh.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/virtcontainers/clh.go b/virtcontainers/clh.go index 2e05418c01..3aa407725b 100644 --- a/virtcontainers/clh.go +++ b/virtcontainers/clh.go @@ -508,14 +508,11 @@ func (clh *cloudHypervisor) terminate() (err error) { } clh.Logger().WithField("PID", pid).Info("Stopping Cloud Hypervisor") - // Check if VM process is running, in case it is not, let's - // return from here. - if err = syscall.Kill(pid, syscall.Signal(0)); err != nil { - return nil - } - // Send a SIGTERM to the VM process to try to stop it properly if err = syscall.Kill(pid, syscall.SIGTERM); err != nil { + if err == syscall.ESRCH { + return nil + } return err }