summaryrefslogtreecommitdiff
path: root/libc/src
diff options
context:
space:
mode:
authorJackson Stogel <jtstogel@gmail.com>2025-11-05 14:35:20 -0800
committerGitHub <noreply@github.com>2025-11-05 14:35:20 -0800
commit81dede888a35281e20b59107a6bf347c23e1c5f6 (patch)
tree1062437bdd87082838c38e6feb443aaa165c7d2c /libc/src
parent521bafc203c80eefd25df8888d21635e3a3dff23 (diff)
[libc] Return errno from OFD failure paths in fcntl. (#166252)
This patch also configures fcntl lock tests to run with F_OFD_* command variants, as all existing lock tests do not exercise process-associated- or OFD-specific functionality.
Diffstat (limited to 'libc/src')
-rw-r--r--libc/src/__support/OSUtil/linux/fcntl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/src/__support/OSUtil/linux/fcntl.cpp b/libc/src/__support/OSUtil/linux/fcntl.cpp
index bb76eee90efd..08db4859c641 100644
--- a/libc/src/__support/OSUtil/linux/fcntl.cpp
+++ b/libc/src/__support/OSUtil/linux/fcntl.cpp
@@ -66,7 +66,7 @@ ErrorOr<int> fcntl(int fd, int cmd, void *arg) {
LIBC_NAMESPACE::syscall_impl<int>(FCNTL_SYSCALL_ID, fd, cmd, &flk64);
// On failure, return
if (ret < 0)
- return Error(-1);
+ return Error(-ret);
// Check for overflow, i.e. the offsets are not the same when cast
// to off_t from off64_t.
if (static_cast<off_t>(flk64.l_len) != flk64.l_len ||