summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2022-04-09 02:09:43 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2022-04-09 02:09:43 +0200
commit428c7a6cd55a8b05766be1b04cde824d1ea190de (patch)
treea2ebdf3eb74bc859089ae9aee08f68b8a0d2b3df
parentffc7c41f936abbe5c8baac129a3c21a277d29933 (diff)
Avoid program die on SIGPIPE signal
-rw-r--r--main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main.c b/main.c
index c3f7ae2..80abea9 100644
--- a/main.c
+++ b/main.c
@@ -16,12 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
+#include <signal.h>
#include "server.h"
#define SERVER_PORT 6667
int main() {
+ sigaction(SIGPIPE, &(struct sigaction){SIG_IGN}, NULL);
+
server_t server = server_create(SERVER_PORT);
server_listen(&server);