From 034cba6af0639093413c355272eb5474a4b159c8 Mon Sep 17 00:00:00 2001 From: rajasec Date: Thu, 13 Oct 2016 23:02:28 +0530 Subject: [PATCH] Fixing runc panic for missing file mode Signed-off-by: rajasec Fixing runc panic for missing file mode Signed-off-by: rajasec --- libcontainer/specconv/spec_linux.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcontainer/specconv/spec_linux.go b/libcontainer/specconv/spec_linux.go index 6f60a6f7..0a263814 100644 --- a/libcontainer/specconv/spec_linux.go +++ b/libcontainer/specconv/spec_linux.go @@ -537,6 +537,8 @@ func createDevices(spec *specs.Spec, config *configs.Config) error { // merge in additional devices from the spec for _, d := range spec.Linux.Devices { var uid, gid uint32 + var filemode os.FileMode = 0666 + if d.UID != nil { uid = *d.UID } @@ -547,12 +549,15 @@ func createDevices(spec *specs.Spec, config *configs.Config) error { if err != nil { return err } + if d.FileMode != nil { + filemode = *d.FileMode + } device := &configs.Device{ Type: dt, Path: d.Path, Major: d.Major, Minor: d.Minor, - FileMode: *d.FileMode, + FileMode: filemode, Uid: uid, Gid: gid, }