forked from TrueCloudLab/restic
Merge pull request #3693 from greatroar/cast-btrfs-super-magic
Cast unix.Statfs_t.Type to int64 when checking for btrfs
This commit is contained in:
commit
305cd1e730
1 changed files with 9 additions and 5 deletions
|
@ -59,9 +59,13 @@ func supportsNoatime(t *testing.T, f *os.File) bool {
|
||||||
err := unix.Fstatfs(int(f.Fd()), &fsinfo)
|
err := unix.Fstatfs(int(f.Fd()), &fsinfo)
|
||||||
rtest.OK(t, err)
|
rtest.OK(t, err)
|
||||||
|
|
||||||
return fsinfo.Type == unix.BTRFS_SUPER_MAGIC ||
|
// The funky cast works around a compiler error on 32-bit archs:
|
||||||
fsinfo.Type == unix.EXT2_SUPER_MAGIC ||
|
// "unix.BTRFS_SUPER_MAGIC (untyped int constant 2435016766) overflows int32".
|
||||||
fsinfo.Type == unix.EXT3_SUPER_MAGIC ||
|
// https://github.com/golang/go/issues/52061
|
||||||
fsinfo.Type == unix.EXT4_SUPER_MAGIC ||
|
typ := int64(uint(fsinfo.Type))
|
||||||
fsinfo.Type == unix.TMPFS_MAGIC
|
return typ == unix.BTRFS_SUPER_MAGIC ||
|
||||||
|
typ == unix.EXT2_SUPER_MAGIC ||
|
||||||
|
typ == unix.EXT3_SUPER_MAGIC ||
|
||||||
|
typ == unix.EXT4_SUPER_MAGIC ||
|
||||||
|
typ == unix.TMPFS_MAGIC
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue