From: John Hodge Date: Mon, 28 Feb 2011 03:02:50 +0000 (+0800) Subject: server - Ignored SIGPIPE (fixes crashes if the client quits unexpectedly) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=43d8a3ef5d51f1a1505fb2d1809a87a141f157fd;p=tpg%2Fopendispense2.git server - Ignored SIGPIPE (fixes crashes if the client quits unexpectedly) --- diff --git a/src/server/server.c b/src/server/server.c index fa50f0d..79a5c2d 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -17,6 +17,7 @@ #include #include #include +#include #define DEBUG_TRACE_CLIENT 0 @@ -119,6 +120,8 @@ void Server_Start(void) struct sockaddr_in server_addr, client_addr; atexit(Server_Cleanup); + // Ignore SIGPIPE (stops crashes when the client exits early) + signal(SIGPIPE, SIG_IGN); // Create Server giServer_Socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);