From 89f24cf350ebac86b1799c88966f0c1bad0b9c99 Mon Sep 17 00:00:00 2001
From: Fredrik Thulin <fredrik@thulin.net>
Date: Thu, 13 Dec 2012 15:50:01 +0100
Subject: [PATCH] Pass flag MSG_NOSIGNAL to send().

This is necessary to not get a SIGPIPE on write failures (easy DoS
of the pkcs11-daemon - client just need to close the connection at
the wrong moment).
---
 gck-rpc-dispatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gck-rpc-dispatch.c b/gck-rpc-dispatch.c
index 4f31e95..f1b4798 100644
--- a/gck-rpc-dispatch.c
+++ b/gck-rpc-dispatch.c
@@ -2077,7 +2077,7 @@ static int write_all(int sock, unsigned char *data, size_t len)
 
 	while (len > 0) {
 
-                r = send(sock, (void *)data, len, 0);
+                r = send(sock, (void *)data, len, MSG_NOSIGNAL);
 
 		if (r == -1) {
 			if (errno == EPIPE) {
-- 
GitLab