about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2015-01-05 15:53:32 +0100
committerMikael Magnusson <mikachu@gmail.com>2015-01-06 23:45:09 +0100
commita150563fb049b338983156a5be4ff760a0d79c20 (patch)
tree869edd0dd7dff15e9fdf08310cc3c8169a73d7dc
parent7e7449592a6e2f10857e6a5e57a17d05e773b554 (diff)
downloadzsh-a150563fb049b338983156a5be4ff760a0d79c20.tar.gz
zsh-a150563fb049b338983156a5be4ff760a0d79c20.tar.xz
zsh-a150563fb049b338983156a5be4ff760a0d79c20.zip
34114: emulate: Handle aborting from mixed -L/-c correctly
Somehow Coverity found this (Issue 1255797, Failure to restore non-local value).
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6fd89cc28..39599afd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-06  Mikael Magnusson  <mikachu@gmail.com>
+
+	* 34114: Src/builtin.c: emulate: Handle aborting from mixed
+	-L/-c correctly
+
 2015-01-06  Barton E. Schaefer  <schaefer@zsh.org>
 
         * 34103: Src/subst.c: fix ancient (workers/15872) thinko that
diff --git a/Src/builtin.c b/Src/builtin.c
index 4a46cbc1f..afa836a03 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5173,7 +5173,7 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
     if (cmd) {
 	if (opt_L) {
 	    zwarnnam("emulate", "option -L incompatible with -c");
-	    goto restore;
+	    goto restore2;
 	}
 	*--argv = cmd;	/* on stack, never free()d, see execbuiltin() */
     } else
@@ -5211,6 +5211,7 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func))
     }
     ret = eval(argv);
     sticky = save_sticky;
+restore2:
     emulation = saveemulation;
     memcpy(opts, saveopts, sizeof(opts));
     restorepatterndisables(savepatterns);