]> git.meshlink.io Git - catta/commitdiff
daemon: make sure we never choke on SIGPIPE
authorLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2010 14:30:30 +0000 (16:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2010 14:30:30 +0000 (16:30 +0200)
avahi-daemon/main.c

index de84f0fad52f57e4783b5ee5b5a6314372b53ce4..b6962cf557119811d86390864b18a91e38db071a 100644 (file)
@@ -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!");