aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Support/Unix/Path.inc13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 9795b6e..0c1623a 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -456,17 +456,8 @@ error_code rename(const Twine &from, const Twine &to) {
StringRef f = from.toNullTerminatedStringRef(from_storage);
StringRef t = to.toNullTerminatedStringRef(to_storage);
- if (::rename(f.begin(), t.begin()) == -1) {
- // If it's a cross device link, copy then delete, otherwise return the error
- if (errno == EXDEV) {
- if (error_code ec = copy_file(from, to, copy_option::overwrite_if_exists))
- return ec;
- bool Existed;
- if (error_code ec = remove(from, Existed))
- return ec;
- } else
- return error_code(errno, system_category());
- }
+ if (::rename(f.begin(), t.begin()) == -1)
+ return error_code(errno, system_category());
return error_code::success();
}