From ac47d07194c3d4163524047231d3869dc3324349 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 19 Jan 2023 10:57:31 +0100 Subject: [PATCH] StopContainer: small refactor Move the stopSignal decl into the branch where it's actually used. [NO NEW TESTS NEEDED] as it's just a small refactor. Signed-off-by: Valentin Rothberg --- libpod/oci_conmon_common.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go index 5ab1a335d8..9b95772b83 100644 --- a/libpod/oci_conmon_common.go +++ b/libpod/oci_conmon_common.go @@ -400,12 +400,11 @@ func (r *ConmonOCIRuntime) StopContainer(ctr *Container, timeout uint, all bool) return nil } - stopSignal := ctr.config.StopSignal - if stopSignal == 0 { - stopSignal = uint(syscall.SIGTERM) - } - if timeout > 0 { + stopSignal := ctr.config.StopSignal + if stopSignal == 0 { + stopSignal = uint(syscall.SIGTERM) + } if err := r.KillContainer(ctr, stopSignal, all); err != nil { // Is the container gone? // If so, it probably died between the first check and