about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2017-08-08 19:00:54 -0400
committerJune McEnroe <june@causal.agency>2017-08-08 19:00:54 -0400
commita58e055fa574c29e833f1fdeb098225594496c76 (patch)
tree2a2db4ba40e620b4c145443c99f1251e0e921a84
parentRewrite help (diff)
downloadtorus-a58e055fa574c29e833f1fdeb098225594496c76.tar.gz
torus-a58e055fa574c29e833f1fdeb098225594496c76.zip
Turn off SIGPIPE at the socket level
I imagine it's better to not generate SIGPIPE at all rather than
generate and ignore.
-rwxr-xr-xserver.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/server.c b/server.c
index fc3b3d0..8ad47ba 100755
--- a/server.c
+++ b/server.c
@@ -260,8 +260,6 @@ static bool clientPut(const struct Client *client, uint8_t color, char cell) {
 int main() {
     int error;
 
-    signal(SIGPIPE, SIG_IGN);
-
     tilesMap();
 
     int server = socket(PF_LOCAL, SOCK_STREAM, 0);
@@ -304,6 +302,10 @@ int main() {
             if (fd < 0) err(EX_IOERR, "accept");
             fcntl(fd, F_SETFL, O_NONBLOCK);
 
+            int on = 1;
+            error = setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on));
+            if (error) err(EX_IOERR, "setsockopt");
+
             struct Client *client = clientAdd(fd);
 
             struct kevent event = {
w/photo.causal.agency/2024-09-02/lens?id=45e859f37e503f2c85a3085a628226831e394b7b&follow=1'>Add photos from September 2June McEnroe 2024-09-13Add Fomapan 200 to films listJune McEnroe 2024-09-10Add August 29 picnic photosJune McEnroe 2024-09-08Apply some bold to trips renderingJune McEnroe 2024-09-08Render trips hopefully more efficientlyJune McEnroe 2024-09-08Allow removing bodies and lensesJune McEnroe 2024-09-08Limit body width so it looks less silly on desktopJune McEnroe 2024-09-07Handle no film being loadedJune McEnroe 2024-09-07Fancy up the text a littleJune McEnroe