summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/exec.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7da6d589d..782fe3474 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-31  Andrey Borzenkov <bor@zsh.org>
+
+	* users/13169: Src/exec.c: really restore emulation mode when
+	exiting shell function if 'emulate -L' has been used (actually
+	if LOCAL_OPTIONS has been set). Fixed problem noticed in RedHat
+	bug https://bugzilla.redhat.com/show_bug.cgi?id=430665#c19.
+
 2008-08-31  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 25569: David Le Bourgeouis & pws: _ant completion was broken
diff --git a/Src/exec.c b/Src/exec.c
index aef97b216..e9f4bc1e8 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4184,7 +4184,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
     int oldzoptind, oldlastval, oldoptcind, oldnumpipestats, ret;
     int *oldpipestats = NULL;
     char saveopts[OPT_SIZE], *oldscriptname = scriptname, *fname = dupstring(name);
-    int obreaks;
+    int obreaks, saveemulation ;
     struct funcstack fstack;
 #ifdef MAX_FUNCTION_DEPTH
     static int funcdepth;
@@ -4223,6 +4223,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
      * not currently set.  That's because if it gets set in the    *
      * function we need to restore the original options on exit.   */
     memcpy(saveopts, opts, sizeof(opts));
+    saveemulation = emulation;
 
     if (flags & PM_TAGGED)
 	opts[XTRACE] = 1;
@@ -4315,6 +4316,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
 	saveopts[PRIVILEGED] = opts[PRIVILEGED];
 	saveopts[RESTRICTED] = opts[RESTRICTED];
 	memcpy(opts, saveopts, sizeof(opts));
+	emulation = saveemulation;
     } else {
 	/* just restore a couple. */
 	opts[XTRACE] = saveopts[XTRACE];