summaryrefslogtreecommitdiff
path: root/pkg/cgroups
diff options
context:
space:
mode:
authorzhangguanzhang <zhangguanzhang@qq.com>2021-06-13 20:32:43 +0800
committerzhangguanzhang <zhangguanzhang@qq.com>2021-06-15 09:22:37 +0800
commitfc9868e2247d2eb651586bd4b3e9a4ece3562fa0 (patch)
treeceb93354e0ae49f64fc8d33a30a0dfa009abc8e1 /pkg/cgroups
parente549ca5078b60defca91c724305cac8929b8ff0f (diff)
downloadpodman-fc9868e2247d2eb651586bd4b3e9a4ece3562fa0.tar.gz
podman-fc9868e2247d2eb651586bd4b3e9a4ece3562fa0.tar.bz2
podman-fc9868e2247d2eb651586bd4b3e9a4ece3562fa0.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)
}