From e60747a9f853a3ea49afbf08d90dfc0fdb5365d6 Mon Sep 17 00:00:00 2001 From: Nate Choe Date: Sun, 27 Feb 2022 22:56:44 -0600 Subject: [PATCH] Removed dangerous exits --- src/main.c | 3 +-- src/runner.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main.c b/src/main.c index f930f6d..c28b6dc 100644 --- a/src/main.c +++ b/src/main.c @@ -138,7 +138,6 @@ NULL } } - if (sitefile == NULL) { fprintf(stderr, "No sitefile configured\n"); exit(EXIT_FAILURE); @@ -230,7 +229,7 @@ NULL lowestThread = i; if (write(notify[lowestThread][1], &stream, sizeof(&stream)) < sizeof(&stream)) - exit(EXIT_FAILURE); + continue; } } diff --git a/src/runner.c b/src/runner.c index 28b1fa5..b1a6fed 100644 --- a/src/runner.c +++ b/src/runner.c @@ -77,24 +77,28 @@ remove: allocConns *= 2; newfds = realloc(fds, sizeof(struct pollfd) * allocConns); - if (newfds == NULL) - exit(EXIT_FAILURE); + if (newfds == NULL) { + allocConns /= 2; + continue; + } fds = newfds; newconns = realloc(connections, sizeof(Connection) * allocConns); - if (newconns == NULL) - exit(EXIT_FAILURE); + if (newconns == NULL) { + allocConns /= 2; + continue; + } connections = newconns; } if (read(notify, &newstream, sizeof(newstream)) < sizeof(newstream)) - exit(EXIT_FAILURE); + continue; fds[connCount].fd = newstream->fd; fds[connCount].events = POLLIN; if (newConnection(newstream, connections + connCount)) - exit(EXIT_FAILURE); + continue; connCount++; pending[id]++; }