From a150563fb049b338983156a5be4ff760a0d79c20 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Mon, 5 Jan 2015 15:53:32 +0100 Subject: 34114: emulate: Handle aborting from mixed -L/-c correctly Somehow Coverity found this (Issue 1255797, Failure to restore non-local value). --- Src/builtin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Src/builtin.c') 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); -- cgit 1.4.1