summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2013-12-28 08:31:55 +0100
committerVijay Bellur <vbellur@redhat.com>2014-01-02 22:02:09 -0800
commitf54e9ca3897177ee41b5f5299b94b719448c46cd (patch)
tree7a8d4893f036ce9b6ba9b4676542a4841065fa87
parentd1f8b7ebc71df415f6b8ff37e9654ecee0d9064c (diff)
Use linkat() instead of link() for portability sake
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: I2633fde3b0828ca8c199e11c827720c513e15852 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/6613 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 a619f9c41a6..117fa209e21 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 6c634dd9ad1..4ba72c02234 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