summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/core-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-05-25 23:56:38 +0200
committerLennart Poettering <lennart@poettering.net>2009-05-26 00:02:29 +0200
commit759a9d0cc56c074567e0048fc0a1058bc179a101 (patch)
tree8c6947084d77c27a25e7d233c70f61de8deec0c1 /src/pulsecore/core-util.c
parentebce3185ef8064ab42106d2fd24aba21a159905d (diff)
core-util: introduce pa_disable_sigpipe()
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r--src/pulsecore/core-util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index d4956fb8..b747cd84 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2711,3 +2711,24 @@ char *pa_realpath(const char *path) {
return t;
}
+
+void pa_disable_sigpipe(void) {
+
+#ifdef SIGPIPE
+ struct sigaction sa;
+
+ pa_zero(sa);
+
+ if (sigaction(SIGPIPE, NULL, &sa) < 0) {
+ pa_log("sigaction(): %s", pa_cstrerror(errno));
+ return;
+ }
+
+ sa.sa_handler = SIG_IGN;
+
+ if (sigaction(SIGPIPE, &sa, NULL) < 0) {
+ pa_log("sigaction(): %s", pa_cstrerror(errno));
+ return;
+ }
+#endif
+}