Skip to content

Commit

Permalink
libcontainer: devices: fix mips builds
Browse files Browse the repository at this point in the history
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 <asarai@suse.de>
  • Loading branch information
cyphar committed Jun 17, 2018
1 parent ad0f525 commit a0e99e7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libcontainer/devices/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit a0e99e7

Please sign in to comment.