about summary refs log tree commit diff
path: root/Src/builtin.c
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 /Src/builtin.c
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).
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c3
1 files changed, 2 insertions, 1 deletions
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);