summaryrefslogtreecommitdiff
path: root/pkg/cgroups
diff options
context:
space:
mode:
authorzhangguanzhang <zhangguanzhang@qq.com>2021-06-13 20:32:43 +0800
committerMatthew Heon <mheon@redhat.com>2021-06-24 14:07:10 -0400
commit854c27c0a02f1c2e3d8ebd2473f639e6bd9b5251 (patch)
tree186a7027b0576b57d665975e7f5e42dba00e6740 /pkg/cgroups
parentb0dc157af9f50f1d9b6d89750e73d496bc6ca730 (diff)
downloadpodman-854c27c0a02f1c2e3d8ebd2473f639e6bd9b5251.tar.gz
podman-854c27c0a02f1c2e3d8ebd2473f639e6bd9b5251.tar.bz2
podman-854c27c0a02f1c2e3d8ebd2473f639e6bd9b5251.zip
Fix panic condition in cgroups.getAvailableControllers
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'pkg/cgroups')
-rw-r--r--pkg/cgroups/cgroups.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index 911edeb5b..9cb32a364 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -165,14 +165,13 @@ func getAvailableControllers(exclude map[string]controllerHandler, cgroup2 bool)
if _, found := exclude[name]; found {
continue
}
- isSymLink := false
fileInfo, err := os.Stat(cgroupRoot + "/" + name)
if err != nil {
- isSymLink = !fileInfo.IsDir()
+ continue
}
c := controller{
name: name,
- symlink: isSymLink,
+ symlink: !fileInfo.IsDir(),
}
controllers = append(controllers, c)
}