about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Src/exec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index f242ab7aa..4765e41b2 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1608,6 +1608,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
     LinkList redir;
     wordcode code;
     Wordcode beg = state->pc, varspc;
+    FILE *oxtrerr = xtrerr;
 
     doneps4 = 0;
     redir = (wc_code(*state->pc) == WC_REDIR ? ecgetredirs(state) : NULL);
@@ -2317,10 +2318,10 @@ execcmd(Estate state, int input, int output, int how, int last1)
     fixfds(save);
 
  done:
-    if (xtrerr != stderr) {
+    if (xtrerr != oxtrerr) {
 	fil = fileno(xtrerr);
 	fclose(xtrerr);
-	xtrerr = stderr;
+	xtrerr = oxtrerr;
 	zclose(fil);
     }
 }