Commit 698fe30b authored by lch's avatar lch

internal: fix fallocate return value on FreeBSD

posix_fallocate(2) returns error directly without setting errno[1]

[1]: https://man.freebsd.org/cgi/man.cgi?query=posix_fallocate&sektion=2

Change-Id: I90ac60ecab6f8814a579cc96d11d4d6660408e88
parent ae8e0199
......@@ -7,9 +7,9 @@ import (
func fallocate(fd int, mode uint32, off int64, len int64) error {
// Ignore mode
_ = mode
_, _, errno := unix.Syscall(unix.SYS_POSIX_FALLOCATE, uintptr(fd), uintptr(off), uintptr(len))
if errno != 0 {
return errno
ret, _, _ := unix.Syscall(unix.SYS_POSIX_FALLOCATE, uintptr(fd), uintptr(off), uintptr(len))
if ret != 0 {
return unix.Errno(ret)
}
return nil
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment