diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-01-14 17:00:14 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-01-14 17:00:14 +0000 |
commit | 455791f265e6e581fa4ebddd5dc4642b2201f8ce (patch) | |
tree | ebd5cad9534291822f8c47dbbc8162525f8fe92e /libglusterfs/src/syscall.c | |
parent | 92eaa72ea4cd0d06c2161842c548008db0eee01c (diff) | |
parent | 7d89ec77763dc5076379753c736f7fce2bedd9ec (diff) |
Merge branch 'upstream' into merge
Diffstat (limited to 'libglusterfs/src/syscall.c')
-rw-r--r-- | libglusterfs/src/syscall.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c index e8954cc23..d1b9ef84c 100644 --- a/libglusterfs/src/syscall.c +++ b/libglusterfs/src/syscall.c @@ -120,7 +120,18 @@ sys_rename (const char *oldpath, const char *newpath) int sys_link (const char *oldpath, const char *newpath) { +#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. + */ + return linkat (AT_FDCWD, oldpath, AT_FDCWD, newpath, 0); +#else return link (oldpath, newpath); +#endif } |