summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/rename.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/rename.c')
-rw-r--r--libc/sysdeps/linux/common/rename.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/rename.c b/libc/sysdeps/linux/common/rename.c
index 6183cf494..3ce5a5e3e 100644
--- a/libc/sysdeps/linux/common/rename.c
+++ b/libc/sysdeps/linux/common/rename.c
@@ -9,5 +9,14 @@
#include <sys/syscall.h>
#include <stdio.h>
+#include <unistd.h>
+#if defined __NR_renameat && !defined __NR_rename
+# include <fcntl.h>
+int rename(const char *oldpath, const char *newpath)
+{
+ return renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath);
+}
+#else
_syscall2(int, rename, const char *, oldpath, const char *, newpath)
+#endif