about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 4576fc031..11d37f1b3 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3218,10 +3218,14 @@ execcmd(Estate state, int input, int output, int how, int last1)
 			_exit(1);
 		}
 		closem(FDT_INTERNAL);
-		if (coprocin)
+		if (coprocin != -1) {
 		    zclose(coprocin);
-		if (coprocout)
+		    coprocin = -1;
+		}
+		if (coprocout != -1) {
 		    zclose(coprocout);
+		    coprocout = -1;
+		}
 #ifdef HAVE_GETRLIMIT
 		if (!forked)
 		    setlimits(NULL);