From c71a9ed732d3b22fd64ac6dbfd2dcc4e22cb5429 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 16 May 2014 10:37:03 +0200 Subject: [PATCH] link.2: Glibc falls back to link() on kernels that lack linkat() Unless 'flags' contains AT_SYMLINK_FOLLOW. Signed-off-by: Michael Kerrisk --- man2/link.2 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/man2/link.2 b/man2/link.2 index 0725cd2b8..492a71aa4 100644 --- a/man2/link.2 +++ b/man2/link.2 @@ -382,6 +382,26 @@ is dereferenced if it is a symbolic link. For precise control over the treatment of symbolic links when creating a link, use .BR linkat (2). +.SS Glibc notes +On older kernels where +.BR linkat () +is unavailable, the glibc wrapper function falls back to the use of +.BR link (), +unless the +.B AT_SYMLINK_FOLLOW +is specified. +When +.I oldpath +and +.I newpath +are relative pathnames, +glibc constructs pathnames based on the symbolic links in +.IR /proc/self/fd +that correspond to the +.I olddirfd +and +.IR newdirfd +arguments. .SH BUGS On NFS filesystems, the return code may be wrong in case the NFS server performs the link creation and dies before it can say so.