From 361897192c39256776b3958e0502563049f10ee3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 27 Nov 2022 19:39:48 +0100 Subject: [PATCH] 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. --- Userland/Libraries/LibC/fcntl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibC/fcntl.cpp b/Userland/Libraries/LibC/fcntl.cpp index 7927845678e..8a8ab0f11f2 100644 --- a/Userland/Libraries/LibC/fcntl.cpp +++ b/Userland/Libraries/LibC/fcntl.cpp @@ -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(syscall(SC_posix_fallocate, fd, &offset, &len)); + return -static_cast(syscall(SC_posix_fallocate, fd, &offset, &len)); } // https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html