Don't die on SIGPIPE

This commit is contained in:
Petr Baudis 2011-11-26 23:37:25 +01:00
parent 07dbb9c4f9
commit 2603aacf1f

View file

@ -4,6 +4,7 @@
#include <cstring> #include <cstring>
#include <netinet/in.h> #include <netinet/in.h>
#include <signal.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h> #include <unistd.h>
@ -22,6 +23,7 @@ main(int argc, char *argv[])
srandom(time(NULL)); srandom(time(NULL));
signal(SIGPIPE, SIG_IGN);
int lfd = socket(AF_INET, SOCK_STREAM, 0); int lfd = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in sin; struct sockaddr_in sin;
memset(&sin, 0, sizeof(sin)); memset(&sin, 0, sizeof(sin));