summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-09 16:04:46 +0200
committerGitHub <noreply@github.com>2022-09-09 16:04:46 +0200
commit04082333a6bf0acf7859ca9a010203ae05980377 (patch)
treef980c2c46dbd2d2b2e77547eaa5c69aeb3794ef6
parent7e7db23dbf163837ba3216fea09b31d2c8409fb3 (diff)
parent6bf8670b694278e5e53655ad40605d099f7ae02b (diff)
downloadpodman-04082333a6bf0acf7859ca9a010203ae05980377.tar.gz
podman-04082333a6bf0acf7859ca9a010203ae05980377.tar.bz2
podman-04082333a6bf0acf7859ca9a010203ae05980377.zip
Merge pull request #15716 from vrothberg/fix-15661
stop: fix error handling
-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)
}