summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/Unix/Path.inc12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 2ecb97316c8..220162d1c19 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -860,12 +860,12 @@ std::error_code real_path(const Twine &path, SmallVectorImpl<char> &dest,
return real_path(Storage, dest, false);
}
- int fd;
- std::error_code EC = openFileForRead(path, fd, &dest);
-
- if (EC)
- return EC;
- ::close(fd);
+ SmallString<128> Storage;
+ StringRef P = path.toNullTerminatedStringRef(Storage);
+ char Buffer[PATH_MAX];
+ if (::realpath(P.begin(), Buffer) == nullptr)
+ return std::error_code(errno, std::generic_category());
+ dest.append(Buffer, Buffer + strlen(Buffer));
return std::error_code();
}
OpenPOWER on IntegriCloud