summaryrefslogtreecommitdiffstats
path: root/bin/sh/error.h
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-11-22 18:23:30 +0000
committerjilles <jilles@FreeBSD.org>2009-11-22 18:23:30 +0000
commit760264169e554e3e2ae8312f8f192d1ad95c7854 (patch)
treed42fd7d5720d96daa7589c733afd3cc29c10f330 /bin/sh/error.h
parentba91da3aff4fb68aa0ec546f7eeb21855b267fc7 (diff)
downloadFreeBSD-src-760264169e554e3e2ae8312f8f192d1ad95c7854.zip
FreeBSD-src-760264169e554e3e2ae8312f8f192d1ad95c7854.tar.gz
Fix various things about SIGINT handling:
* exception handlers are now run with interrupts disabled, which avoids many race conditions * fix some cases where SIGINT only aborts one command and continues the script, in particular if a SIGINT causes an EINTR error which trumped the interrupt. Example: sh -c 'echo < /some/fifo; echo This should not be printed' The fifo should not have writers. When pressing ctrl+c to abort the open, the shell used to continue with the next command. Example: sh -c '/bin/echo < /some/fifo; echo This should not be printed' Similar. Note, however, that this particular case did not and does not work in interactive mode with job control enabled.
Diffstat (limited to 'bin/sh/error.h')
-rw-r--r--bin/sh/error.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/error.h b/bin/sh/error.h
index 4611821..38488c2 100644
--- a/bin/sh/error.h
+++ b/bin/sh/error.h
@@ -72,6 +72,8 @@ extern volatile sig_atomic_t intpending;
#define INTOFF suppressint++
#define INTON { if (--suppressint == 0 && intpending) onint(); }
+#define is_int_on() suppressint
+#define SETINTON(s) suppressint = (s)
#define FORCEINTON {suppressint = 0; if (intpending) onint();}
#define CLEAR_PENDING_INT intpending = 0
#define int_pending() intpending
OpenPOWER on IntegriCloud