Skip to content

Commit

Permalink
Merge pull request opencontainers#1428 from harche/dedupe_ns_array
Browse files Browse the repository at this point in the history
Remove redundant declaration of namespace slice
  • Loading branch information
Mrunal Patel authored May 3, 2017
2 parents efb2bc3 + 22953c1 commit 992a5be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
6 changes: 3 additions & 3 deletions libcontainer/configs/namespaces_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
11 changes: 1 addition & 10 deletions libcontainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 992a5be

Please sign in to comment.