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
This commit is contained in:
Michael J. Spencer 2010-12-07 01:23:39 +00:00
parent 79c3c3a1de
commit 69cbbbf005

View File

@ -395,9 +395,10 @@ rety_open_create:
// Make the path absolute. // Make the path absolute.
char real_path_buff[PATH_MAX + 1]; char real_path_buff[PATH_MAX + 1];
if (realpath(RandomPath.c_str(), real_path_buff) == NULL) { if (realpath(RandomPath.c_str(), real_path_buff) == NULL) {
int error = errno;
::close(RandomFD); ::close(RandomFD);
::unlink(RandomPath.c_str()); ::unlink(RandomPath.c_str());
return error_code(errno, system_category()); return error_code(error, system_category());
} }
result_path.clear(); result_path.clear();