summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-23 16:20:51 -0400
committerJune McEnroe <june@causal.agency>2019-10-23 16:20:51 -0400
commit7ba3cadf1acfa02db16afa9a72549a990448fcc2 (patch)
treed1931d17eea49a0586bf74e09dff0a13db8c2d0d
parentSet an initial loop cap (diff)
downloadpounce-7ba3cadf1acfa02db16afa9a72549a990448fcc2.tar.gz
pounce-7ba3cadf1acfa02db16afa9a72549a990448fcc2.zip
Set NOSIGPIPE on server connection
Diffstat (limited to '')
-rw-r--r--server.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/server.c b/server.c
index f294555..72d668a 100644
--- a/server.c
+++ b/server.c
@@ -69,6 +69,10 @@ int serverConnect(const char *host, const char *port) {
 	if (sock < 0) err(EX_UNAVAILABLE, "%s:%s", host, port);
 	freeaddrinfo(head);
 
+	int yes = 1;
+	error = setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, &yes, sizeof(yes));
+	if (error) err(EX_OSERR, "setsockopt");
+
 	error = tls_connect_socket(client, sock, host);
 	if (error) errx(EX_PROTOCOL, "tls_connect: %s", tls_error(client));