summaryrefslogtreecommitdiff
path: root/bin/ksh/exec.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-11-10 21:26:40 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-11-10 21:26:40 +0000
commitde8e8de6b77224e8b2ac3c698fbc2dabb934f77b (patch)
treed900abc4c52849fcd9a047dec413fa759453d5c3 /bin/ksh/exec.c
parent507ab8275b041b65d552f065abafff05c014342e (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.c8
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;