mirror of https://github.com/containers/podman.git
stop: fix error handling
Fix the error handling in the fallback logic of `stop` when Podman resorts to killing a container; the error message wrapped the wrong error. [NO NEW TESTS NEEDED] as it is a rare flake in the tests and I do not know how to reliably reproduce it. Fixes: #15661 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
parent
e37dd95b7a
commit
6bf8670b69
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue