Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

vc: Remove unnecessary call to kill #2216

Merged
merged 1 commit into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions virtcontainers/acrn.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,11 @@ func (a *Acrn) stopSandbox() (err error) {

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
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")
return err
}
Expand Down
9 changes: 3 additions & 6 deletions virtcontainers/fc.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,11 @@ func (fc *firecracker) fcEnd() (err error) {

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
if err = syscall.Kill(pid, syscall.SIGTERM); err != nil {
if err == syscall.ESRCH {
return nil
}
return err
}

Expand Down