Skip to content

Commit

Permalink
Merge pull request containers#15716 from vrothberg/fix-15661
Browse files Browse the repository at this point in the history
stop: fix error handling
  • Loading branch information
openshift-merge-robot authored Sep 9, 2022
2 parents 7e7db23 + 6bf8670 commit 0408233
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions libpod/oci_conmon_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,11 @@ func (r *ConmonOCIRuntime) StopContainer(ctr *Container, timeout uint, all bool)
}
}

if err := r.KillContainer(ctr, 9, all); err != nil {
if err := r.KillContainer(ctr, uint(unix.SIGKILL), all); err != nil {
// Again, check if the container is gone. If it is, exit cleanly.
err := unix.Kill(ctr.state.PID, 0)
if err == unix.ESRCH {
if aliveErr := unix.Kill(ctr.state.PID, 0); errors.Is(aliveErr, unix.ESRCH) {
return nil
}

return fmt.Errorf("error sending SIGKILL to container %s: %w", ctr.ID(), err)
}

Expand Down

0 comments on commit 0408233

Please sign in to comment.