Skip to content
Snippets Groups Projects
Commit 43d8a3ef authored by John Hodge's avatar John Hodge
Browse files

server - Ignored SIGPIPE (fixes crashes if the client quits unexpectedly)

parent 3a109d09
No related merge requests found
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <signal.h>
#define DEBUG_TRACE_CLIENT 0 #define DEBUG_TRACE_CLIENT 0
...@@ -119,6 +120,8 @@ void Server_Start(void) ...@@ -119,6 +120,8 @@ void Server_Start(void)
struct sockaddr_in server_addr, client_addr; struct sockaddr_in server_addr, client_addr;
atexit(Server_Cleanup); atexit(Server_Cleanup);
// Ignore SIGPIPE (stops crashes when the client exits early)
signal(SIGPIPE, SIG_IGN);
// Create Server // Create Server
giServer_Socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); giServer_Socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment