From 652af839a0e332d081ed5a1beb58e8dc6ea88bfd Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Thu, 26 Dec 2013 09:54:01 +0100 Subject: 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 linkata(2), which ceased to work. BUG: 764655 Change-Id: I7cf9e62ea19c7eb356935c11b480cf637c83126b Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/6594 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/syscall.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libglusterfs') 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) int sys_link (const char *oldpath, const char *newpath) { +#ifdef HAVE_LINKAT + /* see HAVE_LINKAT in xlators/storage/posix/src/posix.c */ + return linkat (AT_FDCWD, oldpath, AT_FDCWD, newpath, 0); +#else return link (oldpath, newpath); +#endif } -- cgit