summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/symlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/symlink.c')
-rw-r--r--libc/sysdeps/linux/common/symlink.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c
index 15a576d70..eee6e8fa0 100644
--- a/libc/sysdeps/linux/common/symlink.c
+++ b/libc/sysdeps/linux/common/symlink.c
@@ -8,8 +8,20 @@
*/
#include <sys/syscall.h>
-
-#if defined __NR_symlink && (defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K)
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <unistd.h>
+
+# if defined __NR_symlinkat && !defined __NR_symlink
+# include <fcntl.h>
+int symlink(const char *oldpath, const char *newpath)
+{
+ return symlinkat(oldpath, AT_FDCWD, newpath);
+}
+
+# elif defined(__NR_symlink)
+
_syscall2(int, symlink, const char *, oldpath, const char *, newpath)
+
+# endif
+
#endif