diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-10-06 23:16:18 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-10-06 23:16:18 +0000 |
commit | 121a174f52805811bb673848ddd87f19665a4633 (patch) | |
tree | eabb18387e7669bd6625a524b9f013659e18cfb9 /llvm/lib/Support/Windows/Process.inc | |
parent | a9ae365b2d0fa3e545fc76b819c00c7915d20f02 (diff) | |
download | llvm-121a174f52805811bb673848ddd87f19665a4633.zip llvm-121a174f52805811bb673848ddd87f19665a4633.tar.gz llvm-121a174f52805811bb673848ddd87f19665a4633.tar.bz2 |
Support: Add a utility to remap std{in,out,err} to /dev/null if closed
It's possible to start a program with one (or all) of the standard file
descriptors closed. Subsequent open system calls will give the program
a low-numbered file descriptor.
This is problematic because we may believe we are writing to standard
out instead of a file.
Introduce Process::FixupStandardFileDescriptors, a helper function to
remap standard file descriptors to /dev/null if they were closed before
the program started.
llvm-svn: 219170
Diffstat (limited to 'llvm/lib/Support/Windows/Process.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Process.inc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc index 61749a7..db87d8e 100644 --- a/llvm/lib/Support/Windows/Process.inc +++ b/llvm/lib/Support/Windows/Process.inc @@ -273,6 +273,10 @@ Process::GetArgumentVector(SmallVectorImpl<const char *> &Args, return ec; } +std::error_code Process::FixupStandardFileDescriptors() { + return std::error_code(); +} + bool Process::StandardInIsUserInput() { return FileDescriptorIsDisplayed(0); } |