1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

LibC: Negate kernel errors before returning them in posix_fallocate()

Since posix_fallocate() doesn't set errno, it has to make sure to
manually "unwrap" any error from the kernel.
This commit is contained in:
Andreas Kling 2022-11-27 19:39:48 +01:00
parent f274f04e35
commit 361897192c

View file

@ -117,7 +117,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
int posix_fallocate(int fd, off_t offset, off_t len)
{
// posix_fallocate does not set errno.
return static_cast<int>(syscall(SC_posix_fallocate, fd, &offset, &len));
return -static_cast<int>(syscall(SC_posix_fallocate, fd, &offset, &len));
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html