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>
This commit is contained in:
Corinna Vinschen 2023-11-27 21:17:12 +01:00
parent 7f9caa4a36
commit 114f89caff
1 changed files with 6 additions and 1 deletions

View File

@ -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