summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-18 17:34:10 +0000
committerChris Lattner <sabre@nondot.org>2010-04-18 17:34:10 +0000
commitd3db453d151b686822cff972d77e4cb947d3a9fe (patch)
tree45e53e3f9229d7759b86265f0eb49c81e99a6a4c /llvm/lib/System
parent8387488f14dd742a1030914fbac93ab934146e98 (diff)
downloadbcm5719-llvm-d3db453d151b686822cff972d77e4cb947d3a9fe.tar.gz
bcm5719-llvm-d3db453d151b686822cff972d77e4cb947d3a9fe.zip
avoid temporary std::string in non posix_spawn path.
llvm-svn: 101723
Diffstat (limited to 'llvm/lib/System')
-rw-r--r--llvm/lib/System/Unix/Program.inc8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/System/Unix/Program.inc b/llvm/lib/System/Unix/Program.inc
index 6b5dc233aa3..47afe52f51d 100644
--- a/llvm/lib/System/Unix/Program.inc
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud