diff options
author | jilles <jilles@FreeBSD.org> | 2009-11-22 18:23:30 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2009-11-22 18:23:30 +0000 |
commit | 760264169e554e3e2ae8312f8f192d1ad95c7854 (patch) | |
tree | d42fd7d5720d96daa7589c733afd3cc29c10f330 /bin/sh/var.c | |
parent | ba91da3aff4fb68aa0ec546f7eeb21855b267fc7 (diff) | |
download | FreeBSD-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/var.c')
-rw-r--r-- | bin/sh/var.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bin/sh/var.c b/bin/sh/var.c index 2c1caf1..6caf956 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -195,7 +195,9 @@ setvarsafe(char *name, char *val, int flags) struct jmploc jmploc; struct jmploc *const savehandler = handler; int err = 0; + int inton; + inton = is_int_on(); if (setjmp(jmploc.loc)) err = 1; else { @@ -203,6 +205,7 @@ setvarsafe(char *name, char *val, int flags) setvar(name, val, flags); } handler = savehandler; + SETINTON(inton); return err; } |