about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-20 01:27:10 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-20 01:27:10 +0000
commit693e45e9bb52776c7c0e740deeb9a02bb6252884 (patch)
treea88e5a27d15d1da2356b05c61e548697f399ffa0 /Src/exec.c
parentac6487085024cb65b94d761add66835aac6b6a6e (diff)
downloadzsh-693e45e9bb52776c7c0e740deeb9a02bb6252884.tar.gz
zsh-693e45e9bb52776c7c0e740deeb9a02bb6252884.tar.xz
zsh-693e45e9bb52776c7c0e740deeb9a02bb6252884.zip
zsh-workers/9794
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 81d9dbd1a..a5e347d89 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -129,7 +129,7 @@ struct execstack *exstack;
 /**/
 mod_export Funcstack funcstack;
 
-#define execerr() if (!forked) { lastval = 1; return; } else _exit(1)
+#define execerr() if (!forked) { lastval = 1; goto done; } else _exit(1)
 
 static LinkList args;
 static int doneps4;
@@ -473,6 +473,7 @@ execute(Cmdnam not_used_yet, int dash)
     }
 
     argv = makecline(args);
+    closem(3);
     child_unblock();
     if ((int) strlen(arg0) >= PATH_MAX) {
 	zerr("command too long: %s", arg0, 0);
@@ -1937,9 +1938,12 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     /* Make a copy of stderr for xtrace output before redirecting */
     fflush(xtrerr);
-    if (xtrerr == stderr &&
-	!(xtrerr = fdopen(movefd(dup(fileno(stderr))), "w")))
-	xtrerr = stderr;
+    if (xtrerr == stderr && (type < WC_SUBSH || type == WC_TIMED)) {
+	if (!(xtrerr = fdopen(movefd(dup(fileno(stderr))), "w")))
+	    xtrerr = stderr;
+	else
+	    fdtable[fileno(xtrerr)] = 3;
+    }
 
     /* Add pipeline input/output to mnodes */
     if (input)