diff options
author | Vijay Bellur <vbellur@redhat.com> | 2014-01-03 11:59:43 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2014-01-14 00:31:20 -0800 |
commit | 54bf0ba4698a2d46db3485cc12ae04dd90349570 (patch) | |
tree | 17b3c8ef5c43e52db14f9bd00c92ecd82dceb385 /xlators/storage/posix/src/posix.c | |
parent | 3af42583dd804371952d61e9d7ff4c640e67ba0d (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 'xlators/storage/posix/src/posix.c')
-rw-r--r-- | xlators/storage/posix/src/posix.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index dc4af1b92f9..83b689d061b 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1930,18 +1930,9 @@ posix_link (call_frame_t *frame, xlator_t *this, goto out; } -#ifdef HAVE_LINKAT - /* - * 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. - */ - op_ret = linkat (AT_FDCWD, real_oldpath, AT_FDCWD, real_newpath, 0); -#else - op_ret = link (real_oldpath, real_newpath); -#endif + + op_ret = sys_link (real_oldpath, real_newpath); + if (op_ret == -1) { op_errno = errno; gf_log (this->name, GF_LOG_ERROR, |