diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-08-22 15:56:52 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-08-22 15:56:52 +0000 |
commit | 8a77bb981595fc594b304aed82cc1a04bd2379f7 (patch) | |
tree | 9d2312ff1bab166570159956a417c93e32f875b2 /llvm/lib/System/Unix | |
parent | ea500426d6dc5380262a7c3cda502876bbf28c6e (diff) | |
download | bcm5719-llvm-8a77bb981595fc594b304aed82cc1a04bd2379f7.tar.gz bcm5719-llvm-8a77bb981595fc594b304aed82cc1a04bd2379f7.zip |
For PR797:
Fix a bug in my last patch that botched file redirection by using explicit
scoping of if statements.
llvm-svn: 29815
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r-- | llvm/lib/System/Unix/Program.inc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/llvm/lib/System/Unix/Program.inc b/llvm/lib/System/Unix/Program.inc index 97aa804b3ce..5961dae5ad0 100644 --- a/llvm/lib/System/Unix/Program.inc +++ b/llvm/lib/System/Unix/Program.inc @@ -133,22 +133,27 @@ Program::ExecuteAndWait(const Path& path, case 0: { // Redirect file descriptors... if (redirects) { - if (redirects[0]) - if (redirects[0]->isEmpty()) + if (redirects[0]) { + if (redirects[0]->isEmpty()) { if (RedirectFD("/dev/null",0,ErrMsg)) { return -1; } - else + } else { if (RedirectFD(redirects[0]->toString(), 0,ErrMsg)) { return -1; } - if (redirects[1]) - if (redirects[1]->isEmpty()) + } + } + if (redirects[1]) { + if (redirects[1]->isEmpty()) { if (RedirectFD("/dev/null",1,ErrMsg)) { return -1; } - else + } else { if (RedirectFD(redirects[1]->toString(),1,ErrMsg)) { return -1; } + } + } if (redirects[1] && redirects[2] && *(redirects[1]) != *(redirects[2])) { - if (redirects[2]->isEmpty()) + if (redirects[2]->isEmpty()) { if (RedirectFD("/dev/null",2,ErrMsg)) { return -1; } - else + } else { if (RedirectFD(redirects[2]->toString(), 2,ErrMsg)) { return -1; } + } } else if (-1 == dup2(1,2)) { MakeErrMsg(ErrMsg, "Can't redirect"); return -1; |