From 2abc6a36057350534b85586b86fc746f5d19c880 Mon Sep 17 00:00:00 2001 From: Yulia Nedyalkova Date: Tue, 31 Mar 2020 15:52:20 +0100 Subject: [PATCH] Actually check for syscall.ENODEV when checking if a container is paused It turns out that ioutil.Readfile wraps the error in a *os.PathError. Since we cannot guarantee compilation with golang >= v1.13, we are manually unwrapping the error. Signed-off-by: Kieron Browne --- libcontainer/container_linux.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index b7c9173e..b74f3f4d 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -1832,7 +1832,10 @@ func (c *linuxContainer) isPaused() (bool, error) { data, err := ioutil.ReadFile(filepath.Join(fcg, filename)) if err != nil { // If freezer cgroup is not mounted, the container would just be not paused. - if os.IsNotExist(err) || err == syscall.ENODEV { + if os.IsNotExist(err) { + return false, nil + } + if pathError, isPathError := err.(*os.PathError); isPathError && pathError.Err == syscall.ENODEV { return false, nil } return false, newSystemErrorWithCause(err, "checking if container is paused")