Skip to content

Commit

Permalink
StopContainer: small refactor
Browse files Browse the repository at this point in the history
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 <vrothberg@redhat.com>
  • Loading branch information
vrothberg committed Jan 19, 2023
1 parent e8b35a8 commit ac47d07
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions libpod/oci_conmon_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ac47d07

Please sign in to comment.