about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Src/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 7993af2da..69a34254e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1908,7 +1908,10 @@ execcmd(Cmd cmd, int input, int output, int how, int last1)
 	    case MERGEOUT:
 		if (fn->fd2 < 10)
 		    closemn(mfds, fn->fd2);
-		if (fn->fd2 > 9 && fdtable[fn->fd2]) {
+		if (fn->fd2 > 9 &&
+		    (fdtable[fn->fd2] ||
+		     fn->fd2 == coprocin ||
+		     fn->fd2 == coprocout)) {
 		    fil = -1;
 		    errno = EBADF;
 		} else {