Ignore SIGPIPE in keyd
authorJonathan McDowell <noodles@earth.li>
Thu, 31 Mar 2011 17:57:41 +0000 (10:57 -0700)
committerJonathan McDowell <noodles@earth.li>
Thu, 31 Mar 2011 17:57:41 +0000 (10:57 -0700)
  catchsignals() normally catches SIGPIPE and sets the cleanup flag,
  as per the other signals it catches. This is fine for the HKP CGI,
  but not appropriate for keyd (as it's probably because the client
  has exited without doing appropriate cleanup). Ignore it; we'll
  deal with the error when we try to read/write to the socket.

keyd.c

diff --git a/keyd.c b/keyd.c
index 919b61b899a886609f29caebf86e841b725c9fce..ccc47502f0fd0e86de306ead5a82ac927619d999 100644 (file)
--- a/keyd.c
+++ b/keyd.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -406,7 +407,8 @@ int main(int argc, char *argv[])
        }
 
        catchsignals();
-       
+       signal(SIGPIPE, SIG_IGN);
+
        snprintf(sockname, 1023, "%s/%s", config.db_dir, KEYD_SOCKET);
        fd = sock_init(sockname);