From 114f89caff7b9b62b0b12bc2c6d143daf47b8042 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 27 Nov 2023 21:17:12 +0100 Subject: Cygwin: fallocate(2): fix evaluating return value fallocate is not supposed to return an errno code, it has to return -1 and set errno. Fixes: dd90ede40510 ("Cygwin: introduce fallocate(2)") Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 0e4c54bcf..b73391d8f 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -3017,8 +3017,13 @@ fallocate (int fd, int mode, off_t offset, off_t len) if (res == EISDIR) res = ENODEV; } + if (res) + { + set_errno (res); + res = -1; + } syscall_printf ("%R = posix_fallocate(%d, %D, %D)", res, fd, offset, len); - return 0; + return res; } extern "C" int -- cgit v1.2.3