From f9917d386685c7f641d493dbc78eb3eb41fb24bd Mon Sep 17 00:00:00 2001
From: Jonathan McDowell <noodles@earth.li>
Date: Thu, 31 Mar 2011 10:57:41 -0700
Subject: [PATCH] Ignore SIGPIPE in keyd

  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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/keyd.c b/keyd.c
index 919b61b..ccc4750 100644
--- 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);
 
-- 
2.39.5