summaryrefslogtreecommitdiff
path: root/lib/System/Win32
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
commit905261efed461e2b9dd505a2569f7f9315906c71 (patch)
tree525dc9b463bb7e575ca76ff4ce844a004162f658 /lib/System/Win32
parent4c54067f67a13999c301a484fda215b9a15a7281 (diff)
downloadllvm-905261efed461e2b9dd505a2569f7f9315906c71.tar.gz
llvm-905261efed461e2b9dd505a2569f7f9315906c71.tar.bz2
llvm-905261efed461e2b9dd505a2569f7f9315906c71.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Win32')
-rw-r--r--lib/System/Win32/Program.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/System/Win32/Program.inc b/lib/System/Win32/Program.inc
index cb002132bf..52eb9677ff 100644
--- a/lib/System/Win32/Program.inc
+++ b/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);