diff --git a/Src/exec.c b/Src/exec.c index 6f09e0d9f..4575aa830 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1268,7 +1268,9 @@ execsimple(Estate state) } else { int q = queue_signal_level(); dont_queue_signals(); - if (code == WC_FUNCDEF) + if (errflag) + lv = errflag; + else if (code == WC_FUNCDEF) lv = execfuncdef(state, NULL); else lv = (execfuncs[code - WC_CURSH])(state, 0); diff --git a/Src/signals.c b/Src/signals.c index 4adf03202..2ce862490 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -672,9 +672,9 @@ zhandler(int sig) if ((isset(PRIVILEGED) || isset(RESTRICTED)) && isset(INTERACTIVE) && (noerrexit & NOERREXIT_SIGNAL)) zexit(SIGINT, ZEXIT_SIGNAL); + errflag |= ERRFLAG_INT; if (list_pipe || chline || simple_pline) { breaks = loops; - errflag |= ERRFLAG_INT; inerrflush(); check_cursh_sig(SIGINT); }