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.
This commit is contained in:
Peter Collingbourne 2022-08-17 16:39:12 -07:00
parent 1219c6b8c0
commit db765bc371

View file

@ -47,4 +47,5 @@ void signal_handlers_install(void)
{ {
signal(SIGHUP, signal_handler); signal(SIGHUP, signal_handler);
signal(SIGINT, signal_handler); signal(SIGINT, signal_handler);
signal(SIGPIPE, SIG_IGN);
} }