aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Path.inc3
-rw-r--r--lib/Support/Unix/Program.inc4
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 886ba6bf6d..b39e465a53 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -811,7 +811,8 @@ sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){
bool
Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
- if (reuse_current && !exists())
+ bool Exists;
+ if (reuse_current && (fs::exists(path, Exists) || !Exists))
return false; // File doesn't exist already, just use it!
// Append an XXXXXX pattern to the end of the file for use with mkstemp,
diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc
index 17c3ba14bc..1104bc7503 100644
--- a/lib/Support/Unix/Program.inc
+++ b/lib/Support/Unix/Program.inc
@@ -17,6 +17,7 @@
//===----------------------------------------------------------------------===//
#include <llvm/Config/config.h>
+#include "llvm/Support/FileSystem.h"
#include "Unix.h"
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -355,7 +356,8 @@ Program::Wait(const sys::Path &path,
// Following the POSIX convention for command-line tools (which posix_spawn
// itself apparently does not), check to see if the failure was due to some
// reason other than the file not existing, and return 126 in this case.
- if (result == 127 && path.exists())
+ bool Exists;
+ if (result == 127 && !llvm::sys::fs::exists(path.str(), Exists) && Exists)
result = 126;
#endif
if (result == 127) {