Skip to content

Commit 3532c53

Browse files
authored
Merge pull request #596 from kinvolk/alban/uid_map-parsing
runtimetest: fix uid_map parsing
2 parents 333d05d + 4e999f2 commit 3532c53

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/runtimetest/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,13 @@ func getIDMappings(path string) ([]rspec.LinuxIDMapping, error) {
632632

633633
idMap := strings.Fields(strings.TrimSpace(s.Text()))
634634
if len(idMap) == 3 {
635-
hostID, err := strconv.ParseUint(idMap[0], 0, 32)
635+
// "man 7 user_namespaces" explains the format of uid_map and gid_map:
636+
// <containerID> <hostID> <mapSize>
637+
containerID, err := strconv.ParseUint(idMap[0], 0, 32)
636638
if err != nil {
637639
return nil, err
638640
}
639-
containerID, err := strconv.ParseUint(idMap[1], 0, 32)
641+
hostID, err := strconv.ParseUint(idMap[1], 0, 32)
640642
if err != nil {
641643
return nil, err
642644
}

0 commit comments

Comments
 (0)