diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-11-10 21:26:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-11-10 21:26:40 +0000 |
commit | de8e8de6b77224e8b2ac3c698fbc2dabb934f77b (patch) | |
tree | d900abc4c52849fcd9a047dec413fa759453d5c3 /bin/ksh/exec.c | |
parent | 507ab8275b041b65d552f065abafff05c014342e (diff) |
If "from fd" == "to fd" don't call dup2() or close "from fd".
Diffstat (limited to 'bin/ksh/exec.c')
-rw-r--r-- | bin/ksh/exec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c index f3192a516c8..995a8a2df9f 100644 --- a/bin/ksh/exec.c +++ b/bin/ksh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.29 2003/11/10 21:24:30 millert Exp $ */ +/* $OpenBSD: exec.c,v 1.30 2003/11/10 21:26:39 millert Exp $ */ /* * execute command tree @@ -230,8 +230,10 @@ execute(t, flags) e->savefd[1] = savefd(1, 0); openpipe(pv); - ksh_dup2(pv[0], 0, FALSE); - close(pv[0]); + if (pv[0] != 0) { + ksh_dup2(pv[0], 0, FALSE); + close(pv[0]); + } coproc.write = pv[1]; coproc.job = (void *) 0; |