https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=114f89caff7b9b62b0b12bc2c6d143daf47b8042
commit 114f89caff7b9b62b0b12bc2c6d143daf47b8042 Author: Corinna Vinschen <[email protected]> AuthorDate: Mon Nov 27 21:17:12 2023 +0100 Commit: Corinna Vinschen <[email protected]> CommitDate: Tue Nov 28 10:55:38 2023 +0100 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 <[email protected]> Diff: --- 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 0e4c54bcfae9..b73391d8f84e 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
