[llvm-commits] CVS: llvm/lib/System/Unix/Program.inc
Reid Spencer
reid at x10sys.com
Tue Aug 22 08:57:06 PDT 2006
Changes in directory llvm/lib/System/Unix:
Program.inc updated: 1.21 -> 1.22
---
Log message:
For PR797: http://llvm.org/PR797 :
Fix a bug in my last patch that botched file redirection by using explicit
scoping of if statements.
---
Diffs of the changes: (+13 -8)
Program.inc | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
Index: llvm/lib/System/Unix/Program.inc
diff -u llvm/lib/System/Unix/Program.inc:1.21 llvm/lib/System/Unix/Program.inc:1.22
--- llvm/lib/System/Unix/Program.inc:1.21 Mon Aug 21 01:02:44 2006
+++ llvm/lib/System/Unix/Program.inc Tue Aug 22 10:56:52 2006
@@ -133,22 +133,27 @@
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;
More information about the llvm-commits
mailing list