about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/rename.c6
-rw-r--r--src/unistd/renameat.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/stdio/rename.c b/src/stdio/rename.c
index 04c90c01..f540adb6 100644
--- a/src/stdio/rename.c
+++ b/src/stdio/rename.c
@@ -4,9 +4,11 @@
 
 int rename(const char *old, const char *new)
 {
-#ifdef SYS_rename
+#if defined(SYS_rename)
 	return syscall(SYS_rename, old, new);
-#else
+#elif defined(SYS_renameat)
 	return syscall(SYS_renameat, AT_FDCWD, old, AT_FDCWD, new);
+#else
+	return syscall(SYS_renameat2, AT_FDCWD, old, AT_FDCWD, new, 0);
 #endif
 }
diff --git a/src/unistd/renameat.c b/src/unistd/renameat.c
index 12574822..c3b40a25 100644
--- a/src/unistd/renameat.c
+++ b/src/unistd/renameat.c
@@ -3,5 +3,9 @@
 
 int renameat(int oldfd, const char *old, int newfd, const char *new)
 {
+#ifdef SYS_renameat
 	return syscall(SYS_renameat, oldfd, old, newfd, new);
+#else
+	return syscall(SYS_renameat2, oldfd, old, newfd, new, 0);
+#endif
 }