Skip to content

Commit 992a5be

Browse files
author
Mrunal Patel
authored
Merge pull request #1428 from harche/dedupe_ns_array
Remove redundant declaration of namespace slice
2 parents efb2bc3 + 22953c1 commit 992a5be

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

libcontainer/configs/namespaces_unix.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ func IsNamespaceSupported(ns NamespaceType) bool {
6464

6565
func NamespaceTypes() []NamespaceType {
6666
return []NamespaceType{
67+
NEWUSER, // Keep user NS always first, don't move it.
68+
NEWIPC,
69+
NEWUTS,
6770
NEWNET,
6871
NEWPID,
6972
NEWNS,
70-
NEWUTS,
71-
NEWIPC,
72-
NEWUSER,
7373
}
7474
}
7575

libcontainer/container_linux.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,17 +1444,8 @@ func (c *linuxContainer) currentState() (*State, error) {
14441444
// can setns in order.
14451445
func (c *linuxContainer) orderNamespacePaths(namespaces map[configs.NamespaceType]string) ([]string, error) {
14461446
paths := []string{}
1447-
order := []configs.NamespaceType{
1448-
// The user namespace *must* be done first.
1449-
configs.NEWUSER,
1450-
configs.NEWIPC,
1451-
configs.NEWUTS,
1452-
configs.NEWNET,
1453-
configs.NEWPID,
1454-
configs.NEWNS,
1455-
}
14561447

1457-
for _, ns := range order {
1448+
for _, ns := range configs.NamespaceTypes() {
14581449

14591450
// Remove namespaces that we don't need to join.
14601451
if !c.config.Namespaces.Contains(ns) {

0 commit comments

Comments
 (0)