diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2023-11-27 21:17:12 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2023-11-28 10:55:38 +0100 |
commit | 114f89caff7b9b62b0b12bc2c6d143daf47b8042 (patch) | |
tree | 04d580b25b43eee842bb9a75f4038fab5b6c6dc3 /winsup | |
parent | 7f9caa4a3698827010d9b478407d21dd58b8bca5 (diff) | |
download | newlib-114f89caff7b9b62b0b12bc2c6d143daf47b8042.zip newlib-114f89caff7b9b62b0b12bc2c6d143daf47b8042.tar.gz newlib-114f89caff7b9b62b0b12bc2c6d143daf47b8042.tar.bz2 |
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.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 0e4c54b..b73391d 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 |