mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
avoid temporary std::string in non posix_spawn path.
llvm-svn: 101723
This commit is contained in:
parent
2cade0b3ff
commit
746abd86e7
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user