path: root/libglusterfs
diff options
authorEmmanuel Dreyfus <>2013-12-19 14:11:45 +0100
committerVijay Bellur <>2014-01-02 22:01:48 -0800
commitd1f8b7ebc71df415f6b8ff37e9654ecee0d9064c (patch)
treea7376a9dd9f0475a7b763e16c5cbf86c9ae450d4 /libglusterfs
parent2ce8918759e9676a54791848fd2ac85f48a05016 (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 linkata(2), which ceased to work. BUG: 764655 Change-Id: Iccd27ac076b7a74e40dcbaa1c4762fd3ad59da5f Signed-off-by: Emmanuel Dreyfus <> Reviewed-on: Tested-by: Gluster Build System <> Reviewed-by: Vijay Bellur <>
Diffstat (limited to 'libglusterfs')
1 files changed, 5 insertions, 0 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index e8954cc23..a619f9c41 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -120,7 +120,12 @@ sys_rename (const char *oldpath, const char *newpath)
sys_link (const char *oldpath, const char *newpath)
+ /* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */
+ return linkat (AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
return link (oldpath, newpath);