From: Markos Chandras <[email protected]>
Signed-off-by: Markos Chandras <[email protected]>
---
include/stdio.h | 1 +
libc/sysdeps/linux/common/rename.c | 9 +++++++++
libc/sysdeps/linux/common/renameat.c | 1 +
3 files changed, 11 insertions(+)
diff --git a/include/stdio.h b/include/stdio.h
index 381ca5f..e0006d2 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -151,6 +151,7 @@ __END_NAMESPACE_STD
/* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */
extern int renameat (int __oldfd, const char *__old, int __newfd,
const char *__new) __THROW;
+libc_hidden_proto(renameat)
#endif
__BEGIN_NAMESPACE_STD
diff --git a/libc/sysdeps/linux/common/rename.c
b/libc/sysdeps/linux/common/rename.c
index 6183cf4..5f35379 100644
--- a/libc/sysdeps/linux/common/rename.c
+++ b/libc/sysdeps/linux/common/rename.c
@@ -8,6 +8,15 @@
*/
#include <sys/syscall.h>
+#include <fcntl.h>
#include <stdio.h>
+#include <unistd.h>
+#if defined(__NR_renameat) && !defined(__NR_rename)
+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
diff --git a/libc/sysdeps/linux/common/renameat.c
b/libc/sysdeps/linux/common/renameat.c
index a898f7b..b0b91fa 100644
--- a/libc/sysdeps/linux/common/renameat.c
+++ b/libc/sysdeps/linux/common/renameat.c
@@ -11,6 +11,7 @@
#ifdef __NR_renameat
_syscall4(int, renameat, int, oldfd, const char *, old, int, newfd, const char
*, new)
+libc_hidden_def(renameat)
#else
/* should add emulation with rename() and /proc/self/fd/ ... */
#endif
--
1.8.1.1
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc