From 714a4d466a729973f7113e66b59796b2829818e4 Mon Sep 17 00:00:00 2001 From: Ace-Tang Date: Sat, 10 Nov 2018 21:04:36 +0800 Subject: [PATCH] rootless: fix potential panic in shouldUseRootlessCgroupManager Signed-off-by: Ace-Tang --- rootless_linux.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rootless_linux.go b/rootless_linux.go index c281682f..3c425dc6 100644 --- a/rootless_linux.go +++ b/rootless_linux.go @@ -15,13 +15,14 @@ func shouldUseRootlessCgroupManager(context *cli.Context) (bool, error) { if err != nil { return false, err } + // nil b stands for "auto detect" if b != nil { return *b, nil } - // nil b stands for "auto detect" - } - if context.GlobalBool("systemd-cgroup") { - return false, nil + + if context.GlobalBool("systemd-cgroup") { + return false, nil + } } if os.Geteuid() != 0 { return true, nil