From 2fb6ef9f407d7933c4dd6de7908bf53104e99e74 Mon Sep 17 00:00:00 2001 From: Šimon Lukašík Date: Thu, 8 Nov 2018 22:27:51 +0100 Subject: Do not hide errors when creating container with UserNSRoot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This one is tricky. By using `:=` operator we have made err variable to be local in the gorutine and different from `err` variable in the surrounding function. And thus `createContainer` function returned always nil, even in cases when some error occurred in the gorutine. Signed-off-by: Šimon Lukašík --- libpod/oci_linux.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libpod/oci_linux.go') diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go index 0447670b3..e6b7cbe4f 100644 --- a/libpod/oci_linux.go +++ b/libpod/oci_linux.go @@ -74,7 +74,8 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string, restor defer wg.Done() runtime.LockOSThread() - fd, err := os.Open(fmt.Sprintf("/proc/%d/task/%d/ns/mnt", os.Getpid(), unix.Gettid())) + var fd *os.File + fd, err = os.Open(fmt.Sprintf("/proc/%d/task/%d/ns/mnt", os.Getpid(), unix.Gettid())) if err != nil { return } -- cgit v1.2.3-54-g00ecf