summaryrefslogtreecommitdiff
path: root/utils/utils_supported.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-22 11:51:53 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-04-22 12:51:29 +0200
commit2a8e435671186bead0e02b13f55e118724175cce (patch)
treec5e39d30702560528d6a340ef1daf7b145be8534 /utils/utils_supported.go
parent56d6ee0808d30c96289568724d748a0e85008638 (diff)
downloadpodman-2a8e435671186bead0e02b13f55e118724175cce.tar.gz
podman-2a8e435671186bead0e02b13f55e118724175cce.tar.bz2
podman-2a8e435671186bead0e02b13f55e118724175cce.zip
enable staticcheck linter
Fix many problems reported by the staticcheck linter, including many real bugs! Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'utils/utils_supported.go')
-rw-r--r--utils/utils_supported.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/utils/utils_supported.go b/utils/utils_supported.go
index ab2de2ce1..493ea61ce 100644
--- a/utils/utils_supported.go
+++ b/utils/utils_supported.go
@@ -6,6 +6,7 @@ package utils
import (
"bufio"
"bytes"
+ "context"
"fmt"
"io/ioutil"
"os"
@@ -32,7 +33,7 @@ func RunUnderSystemdScope(pid int, slice string, unitName string) error {
return err
}
} else {
- conn, err = systemdDbus.New()
+ conn, err = systemdDbus.NewWithContext(context.Background())
if err != nil {
return err
}
@@ -43,10 +44,10 @@ func RunUnderSystemdScope(pid int, slice string, unitName string) error {
properties = append(properties, newProp("Delegate", true))
properties = append(properties, newProp("DefaultDependencies", false))
ch := make(chan string)
- _, err = conn.StartTransientUnit(unitName, "replace", properties, ch)
+ _, err = conn.StartTransientUnitContext(context.Background(), unitName, "replace", properties, ch)
if err != nil {
// On errors check if the cgroup already exists, if it does move the process there
- if props, err := conn.GetUnitTypeProperties(unitName, "Scope"); err == nil {
+ if props, err := conn.GetUnitTypePropertiesContext(context.Background(), unitName, "Scope"); err == nil {
if cgroup, ok := props["ControlGroup"].(string); ok && cgroup != "" {
if err := moveUnderCgroup(cgroup, "", []uint32{uint32(pid)}); err == nil {
return nil