ignore SIGPIPE

this prevents a crash on clients improperly closing sockets
This commit is contained in:
xfnw 2021-11-16 16:16:57 -05:00
parent d968844f65
commit 0df4eebd91
1 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/signal.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <arpa/inet.h>
@ -95,6 +96,8 @@ void *handle_connection(void *socket_desc) {
int main(int argc, char *argv[]) {
int port;
signal(SIGPIPE, SIG_IGN);
port = argc > 1 ? atoi(argv[1]) : 0;
if (!port)
port = 1234;