]> git.apps.os.sepia.ceph.com Git - fscrypt.git/commitdiff
cmd/fscrypt: fix 32-bit build
authorEric Biggers <ebiggers@google.com>
Wed, 3 Jun 2020 00:17:54 +0000 (17:17 -0700)
committerEric Biggers <ebiggers@google.com>
Wed, 3 Jun 2020 00:50:30 +0000 (17:50 -0700)
statfs.Bsize actually has platform-dependent type, despite the Go
documentation listing it as int64.  Fix the build for 32-bit platforms
by casting it to int64.

Resolves https://github.com/google/fscrypt/issues/233

cmd/fscrypt/errors.go

index 8bdab6e975a4383f09aa9f241f9227726e0aa1b0..10d744a40c7547c1d8afee34b9b9810d07db93cc 100644 (file)
@@ -117,8 +117,8 @@ func suggestEnablingEncryption(mnt *filesystem.Mount) string {
                if err := unix.Statfs(mnt.Path, &statfs); err != nil {
                        return ""
                }
-               pagesize := int64(os.Getpagesize())
-               if statfs.Bsize != pagesize && !util.IsKernelVersionAtLeast(5, 5) {
+               pagesize := os.Getpagesize()
+               if int64(statfs.Bsize) != int64(pagesize) && !util.IsKernelVersionAtLeast(5, 5) {
                        return fmt.Sprintf(`This filesystem uses a block size
                        (%d) other than the system page size (%d). Ext4
                        encryption didn't support this case until kernel v5.5.