summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Win32/Program.inc
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-06-12 10:47:18 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-06-12 10:47:18 +0000
commit616e484be4996f3f54e35f39196457893a70f99e (patch)
treee5df03ee1ba8128727e3bc77fdfda3c55e05533d /llvm/lib/System/Win32/Program.inc
parent39a53910797432bcd44ae548edcad54f7f7e0a33 (diff)
downloadbcm5719-llvm-616e484be4996f3f54e35f39196457893a70f99e.tar.gz
bcm5719-llvm-616e484be4996f3f54e35f39196457893a70f99e.zip
Make I/O redirection handling in sys::Program a bit more consistent. No
functional changes. Win32 code is untested, but should work fine. In the unix variant, rename RedirectFD to RedirectIO and let that function handle empty and null paths instead of doing that in the caller 3 times. This is the same as win32 already does it. In the win32 variant, use Path::isEmpty() instead of checking the resulting c_str() manually. This is the same as unix already does it. llvm-svn: 52230
Diffstat (limited to 'llvm/lib/System/Win32/Program.inc')
-rw-r--r--llvm/lib/System/Win32/Program.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/System/Win32/Program.inc b/llvm/lib/System/Win32/Program.inc
index cb002132bfe..52eb9677ffb 100644
--- a/llvm/lib/System/Win32/Program.inc
+++ b/llvm/lib/System/Win32/Program.inc
@@ -77,10 +77,12 @@ static HANDLE RedirectIO(const Path *path, int fd, std::string* ErrMsg) {
0, TRUE, DUPLICATE_SAME_ACCESS);
return h;
}
-
- const char *fname = path->toString().c_str();
- if (*fname == 0)
+
+ const char *fname;
+ if (path->isEmpty())
fname = "NUL";
+ else
+ fname = path->toString().c_str();
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
OpenPOWER on IntegriCloud