diff --git a/libc/src/time/nanosleep.cpp b/libc/src/time/nanosleep.cpp index fe042fc0f1c60..ef20f28b639b9 100644 --- a/libc/src/time/nanosleep.cpp +++ b/libc/src/time/nanosleep.cpp @@ -20,7 +20,7 @@ LLVM_LIBC_FUNCTION(int, nanosleep, (const struct timespec *req, struct timespec *rem)) { int ret = __llvm_libc::syscall_impl(SYS_nanosleep, req, rem); if (ret < 0) { - errno = -ret; + libc_errno = -ret; return -1; } return ret; diff --git a/libc/test/integration/src/unistd/CMakeLists.txt b/libc/test/integration/src/unistd/CMakeLists.txt index 1abe01697ab54..046dc6c4bfbfe 100644 --- a/libc/test/integration/src/unistd/CMakeLists.txt +++ b/libc/test/integration/src/unistd/CMakeLists.txt @@ -10,8 +10,8 @@ add_integration_test( STARTUP libc.startup.linux.crt1 DEPENDS - libc.include.errno libc.src.__support.CPP.string_view + libc.src.errno.errno libc.src.stdlib.getenv libc.src.unistd.getcwd ) diff --git a/libc/test/integration/src/unistd/getcwd_test.cpp b/libc/test/integration/src/unistd/getcwd_test.cpp index 96af6dc2e3a7c..3214ebf7085cf 100644 --- a/libc/test/integration/src/unistd/getcwd_test.cpp +++ b/libc/test/integration/src/unistd/getcwd_test.cpp @@ -7,12 +7,12 @@ //===----------------------------------------------------------------------===// #include "src/__support/CPP/string_view.h" +#include "src/errno/libc_errno.h" #include "src/stdlib/getenv.h" #include "src/unistd/getcwd.h" #include "test/IntegrationTest/test.h" -#include #include // For malloc and free using __llvm_libc::cpp::string_view; @@ -30,13 +30,13 @@ TEST_MAIN(int argc, char **argv, char **envp) { // Bad size cwd = __llvm_libc::getcwd(buffer, 0); ASSERT_TRUE(cwd == nullptr); - ASSERT_EQ(errno, EINVAL); - errno = 0; + ASSERT_EQ(libc_errno, EINVAL); + libc_errno = 0; // Insufficient size cwd = __llvm_libc::getcwd(buffer, 2); ASSERT_TRUE(cwd == nullptr); - int err = errno; + int err = libc_errno; ASSERT_EQ(err, ERANGE); return 0;