]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Add SIGPIPE handler to avoid death when the signal is received
authorpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 16:29:10 +0000 (10:29 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 16:29:10 +0000 (10:29 -0600)
src/rtr/rtr.c

index 8da7c0a49e9b1189c60587bf1abaae7334a0c908..257535d804924bf5ee58fd2f60b9ba3a0b4e90a8 100644 (file)
@@ -3,6 +3,7 @@
 #include <errno.h>
 #include <netdb.h>
 #include <pthread.h>
+#include <signal.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -290,12 +291,17 @@ client_thread_cb(void *arg)
 static int
 handle_client_connections(int server_fd)
 {
+       struct sigaction ign;
        struct sockaddr_storage client_addr;
        struct thread_param *param;
        socklen_t sizeof_client_addr;
        int client_fd;
        int error;
 
+       /* Ignore SIGPIPES, they're handled apart */
+       ign.sa_handler = SIG_IGN;
+       sigaction(SIGPIPE, &ign, NULL);
+
        listen(server_fd, config_get_server_queue());
 
        sizeof_client_addr = sizeof(client_addr);