From db765bc3719eef67b14a93cc8d8aed80fbc8614b Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 17 Aug 2022 16:39:12 -0700 Subject: [PATCH] Ignore SIGPIPE signals If the remote end of a socket is closed between when an input character is received from the serial port and when it is written to the socket, tio will receive a SIGPIPE signal when writing the character to the socket, which will terminate the program. To prevent this, ignore the signal, which will cause write(2) to return -EPIPE, causing tio to close the socket. --- src/signals.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/signals.c b/src/signals.c index 02ccbbe..6829b44 100644 --- a/src/signals.c +++ b/src/signals.c @@ -47,4 +47,5 @@ void signal_handlers_install(void) { signal(SIGHUP, signal_handler); signal(SIGINT, signal_handler); + signal(SIGPIPE, SIG_IGN); }