summaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_common.go
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@redhat.com>2022-09-09 13:29:40 +0200
committerValentin Rothberg <vrothberg@redhat.com>2022-09-09 14:05:18 +0200
commit6bf8670b694278e5e53655ad40605d099f7ae02b (patch)
treeeabda06bdc7d21c44a0599ed53056ba6937eb91f /libpod/oci_conmon_common.go
parente37dd95b7a7839865f9259e5bc91db3dfd175daa (diff)
downloadpodman-6bf8670b694278e5e53655ad40605d099f7ae02b.tar.gz
podman-6bf8670b694278e5e53655ad40605d099f7ae02b.tar.bz2
podman-6bf8670b694278e5e53655ad40605d099f7ae02b.zip
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>
Diffstat (limited to 'libpod/oci_conmon_common.go')
-rw-r--r--libpod/oci_conmon_common.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go
index 87f0aa4ad..0c61de360 100644
--- a/libpod/oci_conmon_common.go
+++ b/libpod/oci_conmon_common.go
@@ -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)
}