[RFC PATCH 13/38] symlink: prefer symlinkat syscall

Jonas Bonn jonas at southpole.se
Tue Sep 6 08:30:37 UTC 2011


Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
 libc/sysdeps/linux/common/symlink.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c
index e53e8d4..ff89848 100644
--- a/libc/sysdeps/linux/common/symlink.c
+++ b/libc/sysdeps/linux/common/symlink.c
@@ -7,8 +7,20 @@
  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  */
 
+#include <fcntl.h>
 #include <sys/syscall.h>
-#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
 #include <unistd.h>
+
+#ifdef __NR_symlinkat
+int symlink(const char* oldpath, const char* newpath)
+{
+	return symlinkat(oldpath, AT_FDCWD, newpath);
+}
+
+#else
+
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
 _syscall2(int, symlink, const char *, oldpath, const char *, newpath)
 #endif
+
+#endif
-- 
1.7.5.4



More information about the uClibc mailing list