[PATCH 12/46] symlink: Use symlinkat if arch does not have the symlink syscall

Markos Chandras markos.chandras at gmail.com
Tue Nov 13 11:31:21 UTC 2012


From: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
---
 libc/sysdeps/linux/common/symlink.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c
index e53e8d4..9632fa3 100644
--- a/libc/sysdeps/linux/common/symlink.c
+++ b/libc/sysdeps/linux/common/symlink.c
@@ -9,6 +9,19 @@
 
 #include <sys/syscall.h>
 #if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
+#include <fcntl.h>
 #include <unistd.h>
+
+#if defined(__NR_symlinkat) && ! defined(__NR_symlink)
+int symlink(const char* oldpath, const char* newpath)
+{
+	return symlinkat(oldpath, AT_FDCWD, newpath);
+}
+
+#else
+
 _syscall2(int, symlink, const char *, oldpath, const char *, newpath)
+
+#endif
+
 #endif
-- 
1.7.1




More information about the uClibc mailing list