diff options
Diffstat (limited to 'bin/sh/error.c')
-rw-r--r-- | bin/sh/error.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/sh/error.c b/bin/sh/error.c index 0c981a3..72061b8 100644 --- a/bin/sh/error.c +++ b/bin/sh/error.c @@ -73,11 +73,15 @@ static void exverror(int, const char *, va_list) __printf0like(2, 0); * Called to raise an exception. Since C doesn't include exceptions, we * just do a longjmp to the exception handler. The type of exception is * stored in the global variable "exception". + * + * Interrupts are disabled; they should be reenabled when the exception is + * caught. */ void exraise(int e) { + INTOFF; if (handler == NULL) abort(); exception = e; @@ -138,8 +142,15 @@ onint(void) static void exverror(int cond, const char *msg, va_list ap) { - CLEAR_PENDING_INT; - INTOFF; + /* + * An interrupt trumps an error. Certain places catch error + * exceptions or transform them to a plain nonzero exit code + * in child processes, and if an error exception can be handled, + * an interrupt can be handled as well. + * + * exraise() will disable interrupts for the exception handler. + */ + FORCEINTON; #ifdef DEBUG if (msg) |