diff --git a/libc/src/stdio/linux/rename.cpp b/libc/src/stdio/linux/rename.cpp index f3d684249ad28..379a6ef3c0c84 100644 --- a/libc/src/stdio/linux/rename.cpp +++ b/libc/src/stdio/linux/rename.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "src/stdio/rename.h" +#include "include/llvm-libc-macros/linux/fcntl-macros.h" #include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" #include "src/errno/libc_errno.h" @@ -15,7 +16,8 @@ namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, rename, (const char *oldpath, const char *newpath)) { - int ret = LIBC_NAMESPACE::syscall_impl(SYS_rename, oldpath, newpath); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_renameat2, AT_FDCWD, oldpath, + AT_FDCWD, newpath, 0); if (ret >= 0) return 0; diff --git a/libc/test/src/stdio/rename_test.cpp b/libc/test/src/stdio/rename_test.cpp index 3ed39fe8c0eb9..a5dd734c63616 100644 --- a/libc/test/src/stdio/rename_test.cpp +++ b/libc/test/src/stdio/rename_test.cpp @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "include/llvm-libc-macros/linux/unistd-macros.h" #include "include/llvm-libc-macros/linux/sys-stat-macros.h" +#include "include/llvm-libc-macros/linux/unistd-macros.h" #include "src/errno/libc_errno.h" #include "src/fcntl/open.h" #include "src/stdio/rename.h"