summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/LockFileManager.cpp33
-rw-r--r--lib/Support/Unix/Path.inc6
-rw-r--r--lib/Support/Windows/Path.inc3
3 files changed, 9 insertions, 33 deletions
diff --git a/lib/Support/LockFileManager.cpp b/lib/Support/LockFileManager.cpp
index b45fcbca2e..ba1047b88a 100644
--- a/lib/Support/LockFileManager.cpp
+++ b/lib/Support/LockFileManager.cpp
@@ -67,22 +67,6 @@ bool LockFileManager::processStillExecuting(StringRef Hostname, int PID) {
return true;
}
-#if LLVM_ON_UNIX
-static error_code unix_create_symbolic_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 (::symlink(t.begin(), f.begin()) == -1)
- return error_code(errno, system_category());
-
- return error_code::success();
-}
-#endif
-
LockFileManager::LockFileManager(StringRef FileName)
{
this->FileName = FileName;
@@ -132,20 +116,9 @@ LockFileManager::LockFileManager(StringRef FileName)
}
while (1) {
-#if LLVM_ON_UNIX
- // Create a symbolic link from the lock file name. If this succeeds, we're
- // done. Note that we are using symbolic link because hard links are not
- // supported by all filesystems.
- error_code EC
- = unix_create_symbolic_link(UniqueLockFileName.str(),
- LockFileName.str());
-#else
- // We can't use symbolic links for windows.
- // Create a hard link from the lock file name. If this succeeds, we're done.
- error_code EC
- = sys::fs::create_hard_link(UniqueLockFileName.str(),
- LockFileName.str());
-#endif
+ // Create a link from the lock file name. If this succeeds, we're done.
+ error_code EC =
+ sys::fs::create_link(UniqueLockFileName.str(), LockFileName.str());
if (EC == errc::success)
return;
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index caa30c7533..2b29baca73 100644
--- a/lib/Support/Unix/Path.inc
+++ b/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();
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc
index c39600357b..a555f3e794 100644
--- a/lib/Support/Windows/Path.inc
+++ b/lib/Support/Windows/Path.inc
@@ -158,7 +158,8 @@ error_code create_directory(const Twine &path, bool IgnoreExisting) {
return error_code::success();
}
-error_code create_hard_link(const Twine &to, const Twine &from) {
+// We can't use symbolic links for windows.
+error_code create_link(const Twine &to, const Twine &from) {
// Get arguments.
SmallString<128> from_storage;
SmallString<128> to_storage;