summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/syscall.c
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2014-01-03 11:59:43 +0530
committerAnand Avati <avati@redhat.com>2014-01-14 00:31:20 -0800
commit54bf0ba4698a2d46db3485cc12ae04dd90349570 (patch)
tree17b3c8ef5c43e52db14f9bd00c92ecd82dceb385 /libglusterfs/src/syscall.c
parent3af42583dd804371952d61e9d7ff4c640e67ba0d (diff)
consolidate code for #ifdef HAVE_LINKAT usage
sys_link() now does ifdef HAVE_LINKAT linkat (...) else link (...) endif Use sys_link() in all places where we previously had the conditional behavior. Change-Id: I8bce5ac1175efd2ba7ab4bb5b372f6d1e0365d28 BUG: 764655 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/6633 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/syscall.c')
-rw-r--r--libglusterfs/src/syscall.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index 117fa209e21..d1b9ef84c96 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -121,7 +121,13 @@ int
sys_link (const char *oldpath, const char *newpath)
{
#ifdef HAVE_LINKAT
- /* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
+ /*
+ * On most systems (Linux being the notable exception), link(2)
+ * first resolves symlinks. If the target is a directory or
+ * is nonexistent, it will fail. linkat(2) operates on the
+ * symlink instead of its target when the AT_SYMLINK_FOLLOW
+ * flag is not supplied.
+ */
return linkat (AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
#else
return link (oldpath, newpath);