-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[libc] Return errno from OFD failure paths in fcntl. #166252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-libc Author: Jackson Stogel (jtstogel) ChangesFull diff: https://github.com/llvm/llvm-project/pull/166252.diff 1 Files Affected:
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 ||
|
|
Do we have a test for this? |
There's an analogous test that checks llvm-project/libc/test/src/fcntl/fcntl_test.cpp Lines 160 to 168 in 285b57b
It looks like more generally none of the OFD paths are tested. Do we have parameterized testing for libc or an issue to add something like |
@lntue to confirm, but I think we basically do ad-hoc parametrized testing in various places -- definitely for math functions with various rounding modes, but also for some stdlib routines: llvm-project/libc/test/src/stdlib/StrtolTest.h Lines 421 to 423 in 285b57b
|
+1 for small ad-hoc parametrizing tests when it makes sense, like when the behaviors / implementations won't diverge in the future. |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/33686 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/147/builds/32458 Here is the relevant piece of the build log for the reference |
Reverts #166252 Causing buildbot failures on `libc-x86_64-debian-dbg-asan`.
…l." (#166658) Reverts llvm/llvm-project#166252 Causing buildbot failures on `libc-x86_64-debian-dbg-asan`.
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.