about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--Src/exec.c20
2 files changed, 27 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 015b66553..4af1d7f70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,20 @@
+2003-11-03  Peter Stephenson  <pws@csr.com>
+
+	* 19216: Src/exec.c: save and restore $pipestatus on functions
+	when noreturnval flag is set.  Remove unnecessary debugging output.
+
 2003-11-02  Felix Rosencrantz <f_rosencrantz@yahoo.com>
 
 	* unposted: Src/.cvsignore, Src/Builtins/.cvsignore,
 	Src/Modules/.cvsignore, Src/Zle/.cvsignore: add *.dll for cygwin
 	builds and fix typo. 
 
+2003-10-29  Peter Stephenson  <pws@csr.com>
+
+	* c.f. 19209: Src/...: Globally replace zcalloc with zshcalloc
+	to avoid clash with zcalloc from zlib; this is linked in on
+	some systems (certainly Debian) for some database lookups.
+
 2003-10-27  Peter Stephenson  <pws@csr.com>
 
 	* zsh-users/6727: from Lloyd Zusman: Completion/Unix/Command/_w3m,
diff --git a/Src/exec.c b/Src/exec.c
index 0b6948c6e..5b17371bb 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3064,8 +3064,6 @@ getproc(char *cmd)
 	if (!out)
 	{
 	    addproc(pid, NULL, 1);
-	    fprintf(stderr, "Proc %d added\n", pid);
-	    fflush(stderr);
 	}
 	return pnam;
     }
@@ -3448,7 +3446,8 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
  * was executed.                                            */
 {
     char **tab, **x, *oargv0;
-    int oldzoptind, oldlastval, oldoptcind;
+    int oldzoptind, oldlastval, oldoptcind, oldnumpipestats;
+    int *oldpipestats = NULL;
     char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name);
     int obreaks;
     struct funcstack fstack;
@@ -3463,6 +3462,16 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
     if (trapreturn < 0)
 	trapreturn--;
     oldlastval = lastval;
+    oldnumpipestats = numpipestats;
+    if (noreturnval) {
+	/*
+	 * Easiest to use the heap here since we're bracketed
+	 * immediately by a pushheap/popheap pair.
+	 */
+	size_t bytes = sizeof(int)*numpipestats;
+	oldpipestats = (int *)zhalloc(bytes);
+	memcpy(oldpipestats, pipestats, bytes);
+    }
 
     starttrapscope();
 
@@ -3568,8 +3577,11 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
 
     if (trapreturn < -1)
 	trapreturn++;
-    if (noreturnval)
+    if (noreturnval) {
 	lastval = oldlastval;
+	numpipestats = oldnumpipestats;
+	memcpy(pipestats, oldpipestats, sizeof(int)*numpipestats);
+    }
     popheap();
 
     if (exit_pending) {