From 22953c122fa2d060bdbec2eb90e7608f66b6b36e Mon Sep 17 00:00:00 2001 From: Harshal Patil Date: Fri, 28 Apr 2017 10:12:56 +0530 Subject: [PATCH] Remove redundant declaraion of namespace slice Signed-off-by: Harshal Patil --- libcontainer/configs/namespaces_unix.go | 6 +++--- libcontainer/container_linux.go | 11 +---------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/libcontainer/configs/namespaces_unix.go b/libcontainer/configs/namespaces_unix.go index 8beba9d30..1f0b3ee28 100644 --- a/libcontainer/configs/namespaces_unix.go +++ b/libcontainer/configs/namespaces_unix.go @@ -64,12 +64,12 @@ func IsNamespaceSupported(ns NamespaceType) bool { func NamespaceTypes() []NamespaceType { return []NamespaceType{ + NEWUSER, // Keep user NS always first, don't move it. + NEWIPC, + NEWUTS, NEWNET, NEWPID, NEWNS, - NEWUTS, - NEWIPC, - NEWUSER, } } diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go index aeaf583cc..173a3f0ff 100644 --- a/libcontainer/container_linux.go +++ b/libcontainer/container_linux.go @@ -1444,17 +1444,8 @@ func (c *linuxContainer) currentState() (*State, error) { // can setns in order. func (c *linuxContainer) orderNamespacePaths(namespaces map[configs.NamespaceType]string) ([]string, error) { paths := []string{} - order := []configs.NamespaceType{ - // The user namespace *must* be done first. - configs.NEWUSER, - configs.NEWIPC, - configs.NEWUTS, - configs.NEWNET, - configs.NEWPID, - configs.NEWNS, - } - for _, ns := range order { + for _, ns := range configs.NamespaceTypes() { // Remove namespaces that we don't need to join. if !c.config.Namespaces.Contains(ns) {