aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-10-17 22:04:42 +0300
committerArnold D. Robbins <arnold@skeeve.com>2013-10-17 22:04:42 +0300
commiteb152bbe507aef92ece4a301863263818fb50a04 (patch)
tree15679ae15d5b385adb039b537f88b04df718b592 /main.c
parentc3f03fe1d5a7c1b2c7b8ff843afc506ce2a45811 (diff)
downloadegawk-eb152bbe507aef92ece4a301863263818fb50a04.tar.gz
egawk-eb152bbe507aef92ece4a301863263818fb50a04.tar.bz2
egawk-eb152bbe507aef92ece4a301863263818fb50a04.zip
Catch SIGPIPE.
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 8 insertions, 0 deletions
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)