aboutsummaryrefslogtreecommitdiffstats
path: root/awk.h
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-03-27 20:30:14 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-03-27 20:30:14 +0300
commit5b7042ea0a68d41c4fbd0d6228f77975ebf8c38b (patch)
treeffd5fa8aecdcc0ef3c6c5043c10b0335d4e59435 /awk.h
parent45099c6ece4f4e91f0d525d10a6d4d162d30e6e4 (diff)
downloadegawk-5b7042ea0a68d41c4fbd0d6228f77975ebf8c38b.tar.gz
egawk-5b7042ea0a68d41c4fbd0d6228f77975ebf8c38b.tar.bz2
egawk-5b7042ea0a68d41c4fbd0d6228f77975ebf8c38b.zip
Die with SIGPIPE when EPIPE happens on stdout.
Diffstat (limited to 'awk.h')
-rw-r--r--awk.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/awk.h b/awk.h
index 163ad362..c1e9b4a9 100644
--- a/awk.h
+++ b/awk.h
@@ -1966,7 +1966,9 @@ erealloc_real(void *ptr, size_t count, const char *where, const char *var, const
#ifdef SIGPIPE
#define ignore_sigpipe() signal(SIGPIPE, SIG_IGN)
#define set_sigpipe_to_default() signal(SIGPIPE, SIG_DFL)
+#define die_via_sigpipe() (signal(SIGPIPE, SIG_DFL), kill(getpid(), SIGPIPE))
#else
#define ignore_sigpipe()
#define set_sigpipe_to_default()
+#define die_via_sigpipe() exit(EXIT_FATAL)
#endif