Merge pull request #1819 from tiborvass/fix-arm32bit

libcontainer: fix compilation on GOARCH=arm GOARM=6 (32 bits)
This commit is contained in:
Mrunal Patel 2018-06-15 07:06:50 -07:00 committed by GitHub
commit ad0f525506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -123,8 +123,8 @@ func UIDMapInUserNS(uidmap []user.IDMap) bool {
} }
// GetParentNSeuid returns the euid within the parent user namespace // GetParentNSeuid returns the euid within the parent user namespace
func GetParentNSeuid() int { func GetParentNSeuid() int64 {
euid := os.Geteuid() euid := int64(os.Geteuid())
uidmap, err := user.CurrentProcessUIDMap() uidmap, err := user.CurrentProcessUIDMap()
if err != nil { if err != nil {
// This kernel-provided file only exists if user namespaces are supported // This kernel-provided file only exists if user namespaces are supported

View File

@ -78,15 +78,15 @@ func groupFromOS(g *user.Group) (Group, error) {
// SubID represents an entry in /etc/sub{u,g}id // SubID represents an entry in /etc/sub{u,g}id
type SubID struct { type SubID struct {
Name string Name string
SubID int SubID int64
Count int Count int64
} }
// IDMap represents an entry in /proc/PID/{u,g}id_map // IDMap represents an entry in /proc/PID/{u,g}id_map
type IDMap struct { type IDMap struct {
ID int ID int64
ParentID int ParentID int64
Count int Count int64
} }
func parseLine(line string, v ...interface{}) { func parseLine(line string, v ...interface{}) {
@ -113,6 +113,8 @@ func parseParts(parts []string, v ...interface{}) {
case *int: case *int:
// "numbers", with conversion errors ignored because of some misbehaving configuration files. // "numbers", with conversion errors ignored because of some misbehaving configuration files.
*e, _ = strconv.Atoi(p) *e, _ = strconv.Atoi(p)
case *int64:
*e, _ = strconv.ParseInt(p, 10, 64)
case *[]string: case *[]string:
// Comma-separated lists. // Comma-separated lists.
if p != "" { if p != "" {
@ -122,7 +124,7 @@ func parseParts(parts []string, v ...interface{}) {
} }
default: default:
// Someone goof'd when writing code using this function. Scream so they can hear us. // 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))
} }
} }
} }