From 02e59c6683d645bd579d01f4cf6efb3647d366a5 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mon, 23 Aug 2021 12:52:47 -0400 Subject: utils.RunUnderSystemdScope(): always close Conn Make sure we close our private connection to the bus, even if we're not successful in in using it to ask systemd to move a unit's processes to a specific control group. [NO TESTS NEEDED] Signed-off-by: Nalin Dahyabhai --- utils/utils_supported.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/utils_supported.go') diff --git a/utils/utils_supported.go b/utils/utils_supported.go index 8668e3fba..ebc870d26 100644 --- a/utils/utils_supported.go +++ b/utils/utils_supported.go @@ -36,6 +36,7 @@ func RunUnderSystemdScope(pid int, slice string, unitName string) error { return err } } + defer conn.Close() properties = append(properties, systemdDbus.PropSlice(slice)) properties = append(properties, newProp("PIDs", []uint32{uint32(pid)})) properties = append(properties, newProp("Delegate", true)) @@ -54,7 +55,6 @@ func RunUnderSystemdScope(pid int, slice string, unitName string) error { } return err } - defer conn.Close() // Block until job is started <-ch -- cgit v1.2.3-54-g00ecf