summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŠimon Lukašík <slukasik@redhat.com>2018-11-08 22:27:51 +0100
committerŠimon Lukašík <slukasik@redhat.com>2018-11-08 22:27:51 +0100
commit2fb6ef9f407d7933c4dd6de7908bf53104e99e74 (patch)
treefe65f88d6e7ffd85921fa4a9771dba038b7e3834
parente106ccf416026e301cd94246d9d1c84c47de8e23 (diff)
downloadpodman-2fb6ef9f407d7933c4dd6de7908bf53104e99e74.tar.gz
podman-2fb6ef9f407d7933c4dd6de7908bf53104e99e74.tar.bz2
podman-2fb6ef9f407d7933c4dd6de7908bf53104e99e74.zip
Do not hide errors when creating container with UserNSRoot
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 <slukasik@redhat.com>
-rw-r--r--libpod/oci_linux.go3
1 files changed, 2 insertions, 1 deletions
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
}