Support/Unix/PathV2: Return the real error from realpath instead of any error
that close or unlink set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121094 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc
index c547e66..fc6b386 100644
--- a/lib/Support/Unix/PathV2.inc
+++ b/lib/Support/Unix/PathV2.inc
@@ -395,9 +395,10 @@
// Make the path absolute.
char real_path_buff[PATH_MAX + 1];
if (realpath(RandomPath.c_str(), real_path_buff) == NULL) {
+ int error = errno;
::close(RandomFD);
::unlink(RandomPath.c_str());
- return error_code(errno, system_category());
+ return error_code(error, system_category());
}
result_path.clear();