From 38bac98c1293fe90b147dad943bbb27c091e6c28 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 23 Sep 2023 10:08:04 +0530 Subject: [PATCH] Fix build of fallocate_darwin.go --- tools/utils/shm/fallocate_darwin.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/utils/shm/fallocate_darwin.go b/tools/utils/shm/fallocate_darwin.go index 62b748bc8..eeb5c8a85 100644 --- a/tools/utils/shm/fallocate_darwin.go +++ b/tools/utils/shm/fallocate_darwin.go @@ -3,9 +3,12 @@ package shm import ( + "errors" "fmt" "syscall" "unsafe" + + "golang.org/x/sys/unix" ) var _ = fmt.Print @@ -15,15 +18,12 @@ func Fallocate_simple(fd int, size int64) (err error) { Flags: syscall.F_ALLOCATEALL, Posmode: syscall.F_PEOFPOSMODE, Offset: 0, - Length: int64(size), + Length: size, } for { - if _, _, err = syscall.Syscall(syscall.SYS_FCNTL, uintptr(out.f.Fd()), syscall.F_PREALLOCATE, uintptr(unsafe.Pointer(store))); !errors.Is(err, unix.EINTR) { - if err != 0 { - return err - } - return nil + if _, _, err = syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), syscall.F_PREALLOCATE, uintptr(unsafe.Pointer(store))); !errors.Is(err, unix.EINTR) { + return err } } }