Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2023-11-27 23:17:12 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-11-28 12:55:38 +0300
commit114f89caff7b9b62b0b12bc2c6d143daf47b8042 (patch)
tree04d580b25b43eee842bb9a75f4038fab5b6c6dc3 /winsup
parent7f9caa4a3698827010d9b478407d21dd58b8bca5 (diff)
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 <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/syscalls.cc7
1 files changed, 6 insertions, 1 deletions
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