aboutsummaryrefslogtreecommitdiff
path: root/keyring/fs_keyring.go
diff options
context:
space:
mode:
authorFilip Stanis <fstanis@google.com>2020-05-05 02:48:26 +0100
committerEric Biggers <ebiggers@google.com>2020-05-09 10:12:52 -0700
commitc5764330ebc69f15b9bf13b94cfef45732864b5a (patch)
tree9923dedcefa40cf3de864cf980fc04b2fe66ff6f /keyring/fs_keyring.go
parentfe860934c793276100b7a60ebbb9325a2cfd910d (diff)
keyring: cast FS_IOC_REMOVE_ENCRYPTION_KEY to uintptr (#221)
Since v0.2.6, fscrypt only builds for 64-bit systems. E.g. trying to build on Raspbian fails with the following error: $ go get github.com/google/fscrypt/cmd/fscrypt # github.com/google/fscrypt/keyring go/src/github.com/google/fscrypt/keyring/fs_keyring.go:231:6: constant 3225445912 overflows int go/src/github.com/google/fscrypt/keyring/fs_keyring.go:235:7: constant 3225445913 overflows int Fix it by making the 'ioc' variable have type uintptr. [EB - removed the later cast to uintptr that became unnecessary, and added explanation to commit message.]
Diffstat (limited to 'keyring/fs_keyring.go')
-rw-r--r--keyring/fs_keyring.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/keyring/fs_keyring.go b/keyring/fs_keyring.go
index f0016a4..262e0e5 100644
--- a/keyring/fs_keyring.go
+++ b/keyring/fs_keyring.go
@@ -228,7 +228,7 @@ func fsRemoveEncryptionKey(descriptor string, mount *filesystem.Mount,
return err
}
- ioc := unix.FS_IOC_REMOVE_ENCRYPTION_KEY
+ ioc := uintptr(unix.FS_IOC_REMOVE_ENCRYPTION_KEY)
iocName := "FS_IOC_REMOVE_ENCRYPTION_KEY"
var savedPrivs *savedPrivs
if user == nil {
@@ -240,7 +240,7 @@ func fsRemoveEncryptionKey(descriptor string, mount *filesystem.Mount,
return err
}
}
- _, _, errno := unix.Syscall(unix.SYS_IOCTL, dir.Fd(), uintptr(ioc), uintptr(unsafe.Pointer(&arg)))
+ _, _, errno := unix.Syscall(unix.SYS_IOCTL, dir.Fd(), ioc, uintptr(unsafe.Pointer(&arg)))
restorePrivs(savedPrivs)
log.Printf("%s(%q, %s) = %v, removal_status_flags=0x%x",