diff --git a/unix.c b/unix.c index 9ae5742..0ab2a2d 100644 --- a/unix.c +++ b/unix.c @@ -103,6 +103,18 @@ extern long Spending_interruptsS; /* Signal handlers */ +/* Note that we turn off SIGPIPE interrupts in a funny way -- we don't +** set the handler to SIGIGN, we set it to a no-op function. This is so +** that when we exec() some other program, the handler will be reset to +** its default, rather than to SIGIGN. +** +** We don't use SIGPIPE, because all write() calls in scsh correctly check +** for error returns, and raise an error exception. Sleazy Unix C programs, +** however, need to get shot down when writing to a closed pipe or socket. +** -Olin 4/97 +*/ + + static RETSIGTYPE when_keyboard_interrupt(sig, code, scp) int sig, code; @@ -124,6 +136,14 @@ when_alarm_interrupt(sig, code, scp) return; } +static RETSIGTYPE +when_pipe_interrupt(sig, code, scp) + int sig, code; + struct sigcontext *scp; +{ + return; +} + /* OS-dependent initialization */ @@ -145,7 +165,7 @@ sysdep_init() /* SIGPIPE's are bogus. -Olin */ {struct sigaction sa; - sa.sa_handler = SIG_IGN; + sa.sa_handler = when_pipe_interrupt; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGPIPE, &sa, NULL);