Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

libcontainer: fix compilation on GOARCH=arm GOARM=6 (32 bits) #1819

Merged
merged 1 commit into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libcontainer/system/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func UIDMapInUserNS(uidmap []user.IDMap) bool {
}

// GetParentNSeuid returns the euid within the parent user namespace
func GetParentNSeuid() int {
euid := os.Geteuid()
func GetParentNSeuid() int64 {
euid := int64(os.Geteuid())
uidmap, err := user.CurrentProcessUIDMap()
if err != nil {
// This kernel-provided file only exists if user namespaces are supported
Expand Down
14 changes: 8 additions & 6 deletions libcontainer/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ func groupFromOS(g *user.Group) (Group, error) {
// SubID represents an entry in /etc/sub{u,g}id
type SubID struct {
Name string
SubID int
Count int
SubID int64
Count int64
}

// IDMap represents an entry in /proc/PID/{u,g}id_map
type IDMap struct {
ID int
ParentID int
Count int
ID int64
ParentID int64
Count int64
}

func parseLine(line string, v ...interface{}) {
Expand All @@ -113,6 +113,8 @@ func parseParts(parts []string, v ...interface{}) {
case *int:
// "numbers", with conversion errors ignored because of some misbehaving configuration files.
*e, _ = strconv.Atoi(p)
case *int64:
*e, _ = strconv.ParseInt(p, 10, 64)
case *[]string:
// Comma-separated lists.
if p != "" {
Expand All @@ -122,7 +124,7 @@ func parseParts(parts []string, v ...interface{}) {
}
default:
// Someone goof'd when writing code using this function. Scream so they can hear us.
panic(fmt.Sprintf("parseLine only accepts {*string, *int, *[]string} as arguments! %#v is not a pointer!", e))
panic(fmt.Sprintf("parseLine only accepts {*string, *int, *int64, *[]string} as arguments! %#v is not a pointer!", e))
}
}
}
Expand Down