Merge "Clarify the fcntl() "that's not how F_SETFD works" error." into main am: b4e2219987 am: dfb9662b24
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2780900
Change-Id: I7c2edb29fc544acabfb09bcd2ad5bed4dcb012f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libc/bionic/fcntl.cpp b/libc/bionic/fcntl.cpp
index 754277b..7730a15 100644
--- a/libc/bionic/fcntl.cpp
+++ b/libc/bionic/fcntl.cpp
@@ -44,7 +44,7 @@
va_end(args);
if (cmd == F_SETFD && (reinterpret_cast<uintptr_t>(arg) & ~FD_CLOEXEC) != 0) {
- __fortify_fatal("fcntl(F_SETFD) passed non-FD_CLOEXEC flag: %p", arg);
+ __fortify_fatal("fcntl(F_SETFD) only supports FD_CLOEXEC but was passed %p", arg);
}
#if defined(__LP64__)
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp
index b3be18e..47f3d91 100644
--- a/tests/fcntl_test.cpp
+++ b/tests/fcntl_test.cpp
@@ -363,5 +363,5 @@
}
TEST_F(fcntl_DeathTest, fcntl_F_SETFD) {
- EXPECT_DEATH(fcntl(0, F_SETFD, O_NONBLOCK), "non-FD_CLOEXEC");
+ EXPECT_DEATH(fcntl(0, F_SETFD, O_NONBLOCK), "only supports FD_CLOEXEC");
}