Skip to content

Commit

Permalink
Merge pull request #596 from kinvolk/alban/uid_map-parsing
Browse files Browse the repository at this point in the history
runtimetest: fix uid_map parsing
  • Loading branch information
liangchenye authored Mar 9, 2018
2 parents 333d05d + 4e999f2 commit 3532c53
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/runtimetest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,11 +632,13 @@ func getIDMappings(path string) ([]rspec.LinuxIDMapping, error) {

idMap := strings.Fields(strings.TrimSpace(s.Text()))
if len(idMap) == 3 {
hostID, err := strconv.ParseUint(idMap[0], 0, 32)
// "man 7 user_namespaces" explains the format of uid_map and gid_map:
// <containerID> <hostID> <mapSize>
containerID, err := strconv.ParseUint(idMap[0], 0, 32)
if err != nil {
return nil, err
}
containerID, err := strconv.ParseUint(idMap[1], 0, 32)
hostID, err := strconv.ParseUint(idMap[1], 0, 32)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3532c53

Please sign in to comment.