diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-18 17:34:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-18 17:34:10 +0000 |
commit | d65077a50901cbe55d8285bb1149eb8ba8210a58 (patch) | |
tree | 01d26140c2b58e710c93a0df73f202a402310360 /lib/System | |
parent | d7aef9b440fa7dfb41a5dfdb9723f1fdee976289 (diff) | |
download | external_llvm-d65077a50901cbe55d8285bb1149eb8ba8210a58.zip external_llvm-d65077a50901cbe55d8285bb1149eb8ba8210a58.tar.gz external_llvm-d65077a50901cbe55d8285bb1149eb8ba8210a58.tar.bz2 |
avoid temporary std::string in non posix_spawn path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r-- | lib/System/Unix/Program.inc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 6b5dc23..47afe52 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -104,17 +104,17 @@ Program::FindProgramByName(const std::string& progName) { static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) { if (Path == 0) // Noop return false; - std::string File; + const char *File; if (Path->isEmpty()) // Redirect empty paths to /dev/null File = "/dev/null"; else - File = Path->str(); + File = Path->c_str(); // Open the file - int InFD = open(File.c_str(), FD == 0 ? O_RDONLY : O_WRONLY|O_CREAT, 0666); + int InFD = open(File, FD == 0 ? O_RDONLY : O_WRONLY|O_CREAT, 0666); if (InFD == -1) { - MakeErrMsg(ErrMsg, "Cannot open file '" + File + "' for " + MakeErrMsg(ErrMsg, "Cannot open file '" + std::string(File) + "' for " + (FD == 0 ? "input" : "output")); return true; } |