[libc-commits] [libc] Return errno from F_OFD_SETLKW failure path in fcntl. (PR #166252)
Jackson Stogel via libc-commits
libc-commits at lists.llvm.org
Mon Nov 3 14:52:53 PST 2025
https://github.com/jtstogel created https://github.com/llvm/llvm-project/pull/166252
None
>From c405238598ca0a84efec136ed27c4d552e8de068 Mon Sep 17 00:00:00 2001
From: Jackson Stogel <jtstogel at gmail.com>
Date: Mon, 3 Nov 2025 22:48:55 +0000
Subject: [PATCH] Return errno from F_OFD_SETLKW failure path in fcntl.
---
libc/src/__support/OSUtil/linux/fcntl.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/src/__support/OSUtil/linux/fcntl.cpp b/libc/src/__support/OSUtil/linux/fcntl.cpp
index bb76eee90efd2..08db4859c6417 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 ||
More information about the libc-commits
mailing list