mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
For PR797:
Fix a bug in my last patch that botched file redirection by using explicit scoping of if statements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f4d40050f1
commit
ad42ea7356
@ -133,22 +133,27 @@ Program::ExecuteAndWait(const Path& path,
|
|||||||
case 0: {
|
case 0: {
|
||||||
// Redirect file descriptors...
|
// Redirect file descriptors...
|
||||||
if (redirects) {
|
if (redirects) {
|
||||||
if (redirects[0])
|
if (redirects[0]) {
|
||||||
if (redirects[0]->isEmpty())
|
if (redirects[0]->isEmpty()) {
|
||||||
if (RedirectFD("/dev/null",0,ErrMsg)) { return -1; }
|
if (RedirectFD("/dev/null",0,ErrMsg)) { return -1; }
|
||||||
else
|
} else {
|
||||||
if (RedirectFD(redirects[0]->toString(), 0,ErrMsg)) { return -1; }
|
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; }
|
if (RedirectFD("/dev/null",1,ErrMsg)) { return -1; }
|
||||||
else
|
} else {
|
||||||
if (RedirectFD(redirects[1]->toString(),1,ErrMsg)) { return -1; }
|
if (RedirectFD(redirects[1]->toString(),1,ErrMsg)) { return -1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
if (redirects[1] && redirects[2] &&
|
if (redirects[1] && redirects[2] &&
|
||||||
*(redirects[1]) != *(redirects[2])) {
|
*(redirects[1]) != *(redirects[2])) {
|
||||||
if (redirects[2]->isEmpty())
|
if (redirects[2]->isEmpty()) {
|
||||||
if (RedirectFD("/dev/null",2,ErrMsg)) { return -1; }
|
if (RedirectFD("/dev/null",2,ErrMsg)) { return -1; }
|
||||||
else
|
} else {
|
||||||
if (RedirectFD(redirects[2]->toString(), 2,ErrMsg)) { return -1; }
|
if (RedirectFD(redirects[2]->toString(), 2,ErrMsg)) { return -1; }
|
||||||
|
}
|
||||||
} else if (-1 == dup2(1,2)) {
|
} else if (-1 == dup2(1,2)) {
|
||||||
MakeErrMsg(ErrMsg, "Can't redirect");
|
MakeErrMsg(ErrMsg, "Can't redirect");
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user