summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2013-12-28 08:31:23 +0100
committerVijay Bellur <vbellur@redhat.com>2014-01-02 22:01:09 -0800
commit4dd5f7507eb3009bf9aa85f3accf6ffb5fa42662 (patch)
tree2fef7672060292e9c6bf6afc914a6f736990571e
parent652af839a0e332d081ed5a1beb58e8dc6ea88bfd (diff)
Use linkat() instead of link() for portability sake
This is a backport of Iccd27ac076b7a74e40dcbaa1c4762fd3ad59da5f POSIX does not says wether link(2) on symlink should link on symlink itself or on target. Linux use symlink, most other systems use target. Using linkat(2) allows the behavior to be specified, so that the behavior is portable. Also fix configure test for NetBSD linkat(2), which ceased to work. BUG: 764655 Change-Id: Ifcabda5e81b15cd80982bcfc05afda4c9e5370ef Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/6612 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--libglusterfs/src/syscall.c2
-rw-r--r--xlators/features/index/src/index.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index a619f9c41..117fa209e 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -120,7 +120,7 @@ sys_rename (const char *oldpath, const char *newpath)
int
sys_link (const char *oldpath, const char *newpath)
{
-#ifdef HAVE_LINKAT
+#ifdef HAVE_LINKAT
/* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
return linkat (AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
#else
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 295f68198..9fa32129e 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -409,7 +409,8 @@ sync_base_indices (void *index_priv)
#ifdef HAVE_LINKAT
/* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
- ret = linkat (AT_FDCWD, xattrop_index_path, AT_FDCWD, base_index_path, 0);
+ ret = linkat (AT_FDCWD, xattrop_index_path,
+ AT_FDCWD, base_index_path, 0);
#else
ret = link (xattrop_index_path, base_index_path);
#endif