core-util: introduce pa_disable_sigpipe()

This commit is contained in:
Lennart Poettering 2009-05-25 23:56:38 +02:00
parent ebce3185ef
commit 759a9d0cc5
4 changed files with 27 additions and 4 deletions

View file

@ -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
}