driver: Map closed standard file descriptors to /dev/null

Utilize Process::FixupStandardFileDescriptors, introduced in r219170, to
guard against files from being treated as one of the standard file
descriptors.

llvm-svn: 219174
This commit is contained in:
David Majnemer 2014-10-06 23:52:23 +00:00
parent 35ee87debe
commit 3349872cf3
1 changed files with 3 additions and 0 deletions

View File

@ -378,6 +378,9 @@ int main(int argc_, const char **argv_) {
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc_, argv_);
if (llvm::sys::Process::FixupStandardFileDescriptors())
return 1;
SmallVector<const char *, 256> argv;
llvm::SpecificBumpPtrAllocator<char> ArgAllocator;
std::error_code EC = llvm::sys::Process::GetArgumentVector(