18659: Cast OS-specific device number type to uint64.
authorTom Clegg <tom@curii.com>
Thu, 20 Jan 2022 17:04:51 +0000 (12:04 -0500)
committerTom Clegg <tom@curii.com>
Thu, 20 Jan 2022 17:04:51 +0000 (12:04 -0500)
Fixes compile error on GOOS=darwin.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/keepstore/unix_volume.go

index a053ba3e6b19042c48423cf31303e8cc2059fa1d..dd62cf1319318fb4f5dbe52869311bb55b6b8008 100644 (file)
@@ -321,7 +321,12 @@ func (v *UnixVolume) Status() *VolumeStatus {
                v.logger.WithError(err).Error("stat failed")
                return nil
        }
-       devnum := fi.Sys().(*syscall.Stat_t).Dev
+       // uint64() cast here supports GOOS=darwin where Dev is
+       // int32. If the device number is negative, the unsigned
+       // devnum won't be the real device number any more, but that's
+       // fine -- all we care about is getting the same number each
+       // time.
+       devnum := uint64(fi.Sys().(*syscall.Stat_t).Dev)
 
        var fs syscall.Statfs_t
        if err := syscall.Statfs(v.Root, &fs); err != nil {