aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Unix/Path.inc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-03-11 18:40:24 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-03-11 18:40:24 +0000
commit83f858e578d3efa07549c1757d675293bc844b9a (patch)
treee1cfec2ace6af51b8973a1b30d50896d7c470d12 /llvm/lib/Support/Unix/Path.inc
parent698a5bdbba4c01c39a03b23280cd95ecbf153164 (diff)
downloadllvm-83f858e578d3efa07549c1757d675293bc844b9a.zip
llvm-83f858e578d3efa07549c1757d675293bc844b9a.tar.gz
llvm-83f858e578d3efa07549c1757d675293bc844b9a.tar.bz2
Cleanup the interface for creating soft or hard links.
Before this patch the unix code for creating hardlinks was unused. The code for creating symbolic links was implemented in lib/Support/LockFileManager.cpp and the code for creating hard links in lib/Support/*/Path.inc. The only use we have for these is in LockFileManager.cpp and it can use both soft and hard links. Just have a create_link function that creates one or the other depending on the platform. llvm-svn: 203596
Diffstat (limited to 'llvm/lib/Support/Unix/Path.inc')
-rw-r--r--llvm/lib/Support/Unix/Path.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index caa30c7..2b29bac 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -272,14 +272,16 @@ error_code create_directory(const Twine &path, bool IgnoreExisting) {
return error_code::success();
}
-error_code create_hard_link(const Twine &to, const Twine &from) {
+// Note that we are using symbolic link because hard links are not supported by
+// all filesystems (SMB doesn't).
+error_code create_link(const Twine &to, const Twine &from) {
// Get arguments.
SmallString<128> from_storage;
SmallString<128> to_storage;
StringRef f = from.toNullTerminatedStringRef(from_storage);
StringRef t = to.toNullTerminatedStringRef(to_storage);
- if (::link(t.begin(), f.begin()) == -1)
+ if (::symlink(t.begin(), f.begin()) == -1)
return error_code(errno, system_category());
return error_code::success();