[libc-commits] [libc] [libc][fcntl] Simplify the handling of the return value from syscall … (PR #96325)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Jun 25 13:21:45 PDT 2024


================
@@ -162,4 +163,23 @@ TEST(LlvmLibcFcntlTest, UseAfterClose) {
   ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0));
   ASSERT_EQ(-1, LIBC_NAMESPACE::fcntl(fd, F_GETFL));
   ASSERT_ERRNO_EQ(EBADF);
+  LIBC_NAMESPACE::libc_errno = 0;
----------------
nickdesaulniers wrote:

I just noticed that other tests tend to zero libc_errno before running any operations.  We should clear errno first, for tests that need it, rather than reset it after tests that touch it.

https://github.com/llvm/llvm-project/pull/96325


More information about the libc-commits mailing list