From 2953ba9e66ad9cb8ac7f75bab5c24fe0ccc84ae9 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Tue, 7 Dec 2010 01:23:39 +0000 Subject: [PATCH] Support/Unix/PathV2: Return the real error from realpath instead of any error that close or unlink set. llvm-svn: 121094 --- lib/Support/Unix/PathV2.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc index c547e6606f7..fc6b3867d57 100644 --- a/lib/Support/Unix/PathV2.inc +++ b/lib/Support/Unix/PathV2.inc @@ -395,9 +395,10 @@ rety_open_create: // 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();