From 51f97cbf68b80b56c52e351c539a37b7673b8920 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 10 Jul 2010 16:30:30 +0200 Subject: [PATCH] daemon: make sure we never choke on SIGPIPE --- avahi-daemon/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index de84f0f..b6962cf 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -1075,6 +1075,16 @@ static void signal_callback(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AVAHI_GC /* Imported from ../avahi-client/nss-check.c */ int avahi_nss_support(void); +static void ignore_signal(int sig) { + struct sigaction sa; + + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_RESTART; + + sigaction(sig, &sa, NULL); +} + static int run_server(DaemonConfig *c) { int r = -1; int error; @@ -1091,6 +1101,8 @@ static int run_server(DaemonConfig *c) { assert(c); + ignore_signal(SIGPIPE); + if (!(nss_support = avahi_nss_support())) avahi_log_warn("WARNING: No NSS support for mDNS detected, consider installing nss-mdns!"); -- 2.39.5