aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2021-08-23 12:52:47 -0400
committerMatthew Heon <mheon@redhat.com>2021-08-30 13:31:49 -0400
commitd1ea5454939745f98c42c00269fd646a08c5b6ac (patch)
tree07cf62ce809b7900010bdc183c5ce3fcfa5afe3d
parent17afae4ebdc44fdea8f4dfccdd347e5a65804427 (diff)
downloadpodman-d1ea5454939745f98c42c00269fd646a08c5b6ac.tar.gz
podman-d1ea5454939745f98c42c00269fd646a08c5b6ac.tar.bz2
podman-d1ea5454939745f98c42c00269fd646a08c5b6ac.zip
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 <nalin@redhat.com>
-rw-r--r--utils/utils_supported.go2
1 files changed, 1 insertions, 1 deletions
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