vc: Remove unnecessary call to kill

Fixes #2207

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
Ted Yu 2019-11-19 05:46:20 -08:00
parent c0d2867a0e
commit 618666ed8c
2 changed files with 6 additions and 13 deletions

View File

@ -513,15 +513,11 @@ func (a *Acrn) stopSandbox() (err error) {
pid := a.state.PID pid := a.state.PID
// 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 {
a.Logger().Info("acrn VM already stopped")
return nil
}
// Send signal to the VM process to try to stop it properly // Send signal to the VM process to try to stop it properly
if err = syscall.Kill(pid, syscall.SIGINT); err != nil { if err = syscall.Kill(pid, syscall.SIGINT); err != nil {
if err == syscall.ESRCH {
return nil
}
a.Logger().Info("Sending signal to stop acrn VM failed") a.Logger().Info("Sending signal to stop acrn VM failed")
return err return err
} }

View File

@ -467,14 +467,11 @@ func (fc *firecracker) fcEnd() (err error) {
pid := fc.info.PID pid := fc.info.PID
// 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 // 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.Kill(pid, syscall.SIGTERM); err != nil {
if err == syscall.ESRCH {
return nil
}
return err return err
} }