From a0e99e7a1a12c19839e2779fa3dfb43cf73bbf73 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Sun, 17 Jun 2018 11:22:01 +1000 Subject: [PATCH] libcontainer: devices: fix mips builds It turns out that MIPS uses uint32 in the device number returned by stat(2), so explicitly wrap everything to make the compiler happy. I really wish that Go had C-like numeric type promotion. Signed-off-by: Aleksa Sarai --- libcontainer/devices/devices.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libcontainer/devices/devices.go b/libcontainer/devices/devices.go index 3619258905d..5e2ab0581e2 100644 --- a/libcontainer/devices/devices.go +++ b/libcontainer/devices/devices.go @@ -30,8 +30,9 @@ func DeviceFromPath(path, permissions string) (*configs.Device, error) { } var ( - devNumber = stat.Rdev + devNumber = uint64(stat.Rdev) major = unix.Major(devNumber) + minor = unix.Minor(devNumber) ) if major == 0 { return nil, ErrNotADevice @@ -51,7 +52,7 @@ func DeviceFromPath(path, permissions string) (*configs.Device, error) { Type: devType, Path: path, Major: int64(major), - Minor: int64(unix.Minor(devNumber)), + Minor: int64(minor), Permissions: permissions, FileMode: os.FileMode(mode), Uid: stat.Uid,