summaryrefslogtreecommitdiff
path: root/pkg/cgroups/cgroups.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-22 13:13:50 +0200
committerGitHub <noreply@github.com>2019-07-22 13:13:50 +0200
commit3b52e4d0b5baacf5f63516c664a117a7537a075e (patch)
treeef6dc8150136e7941daf45a2e6b615dee43c7893 /pkg/cgroups/cgroups.go
parentd6b41eb393c154eaff79b4fdcb04c7510a6fdb20 (diff)
parentdb826d5d75630cca784bd7092eba5b06601ae27f (diff)
downloadpodman-3b52e4d0b5baacf5f63516c664a117a7537a075e.tar.gz
podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.tar.bz2
podman-3b52e4d0b5baacf5f63516c664a117a7537a075e.zip
Merge pull request #3562 from baude/golangcilint3
golangci-lint round #3
Diffstat (limited to 'pkg/cgroups/cgroups.go')
-rw-r--r--pkg/cgroups/cgroups.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index fda19bff8..f2c6b548e 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -155,7 +155,7 @@ func createCgroupv2Path(path string) (Err error) {
if err != nil {
return errors.Wrapf(err, "read /sys/fs/cgroup/cgroup.controllers")
}
- if !filepath.HasPrefix(path, "/sys/fs/cgroup") {
+ if !strings.HasPrefix(path, "/sys/fs/cgroup/") {
return fmt.Errorf("invalid cgroup path %s", path)
}
@@ -274,12 +274,6 @@ func readFileAsUint64(path string) (uint64, error) {
return ret, nil
}
-func (c *CgroupControl) writePidToTasks(pid int, name string) error {
- path := filepath.Join(c.getCgroupv1Path(name), "tasks")
- payload := []byte(fmt.Sprintf("%d", pid))
- return ioutil.WriteFile(path, payload, 0644)
-}
-
// New creates a new cgroup control
func New(path string, resources *spec.LinuxResources) (*CgroupControl, error) {
cgroup2, err := IsCgroup2UnifiedMode()
@@ -384,7 +378,7 @@ func rmDirRecursively(path string) error {
}
}
}
- if os.Remove(path); err != nil {
+ if err := os.Remove(path); err != nil {
if !os.IsNotExist(err) {
return errors.Wrapf(err, "remove %s", path)
}