From f4c0d06103f072bbb2dbdeff72e8e6db07857dbb Mon Sep 17 00:00:00 2001 From: Zefan Li Date: Fri, 19 Jun 2015 09:44:23 +0800 Subject: [PATCH] Fix sysinfo regression The cleanup to sysinfo package introduced a regression. If memory cgroup isn't supported and --memory is specified when starting a container, we should return info instead of nil in checkCgroupMem(), otherwise we'll access a nil pointer. Signed-off-by: Zefan Li --- sysinfo/sysinfo_linux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysinfo/sysinfo_linux.go b/sysinfo/sysinfo_linux.go index 5d98d16..75700d9 100644 --- a/sysinfo/sysinfo_linux.go +++ b/sysinfo/sysinfo_linux.go @@ -38,7 +38,7 @@ func checkCgroupMem(quiet bool) *cgroupMemInfo { if !quiet { logrus.Warnf("Your kernel does not support cgroup memory limit: %v", err) } - return nil + return info } info.MemoryLimit = true @@ -61,7 +61,7 @@ func checkCgroupCpu(quiet bool) *cgroupCpuInfo { if !quiet { logrus.Warn(err) } - return nil + return info } info.CpuCfsPeriod = cgroupEnabled(mountPoint, "cpu.cfs_period_us")