From eb152bbe507aef92ece4a301863263818fb50a04 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 17 Oct 2013 22:04:42 +0300 Subject: Catch SIGPIPE. --- main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 79508c7d..d765a43b 100644 --- a/main.c +++ b/main.c @@ -284,6 +284,14 @@ main(int argc, char **argv) #ifdef SIGBUS (void) signal(SIGBUS, catchsig); #endif +#ifdef SIGPIPE + /* + * Ignore SIGPIPE so that writes to pipes that fail don't + * kill the process but instead return -1 and set errno. + * That lets us print a fatal message instead of dieing suddenly. + */ + signal(SIGPIPE, SIG_IGN); +#endif (void) sigsegv_install_handler(catchsegv); #define STACK_SIZE (16*1024) -- cgit v1.2.3