From: Egor Date: Wed, 18 Oct 2023 20:08:20 +0000 (+0300) Subject: use sigaction to set handler for SIGPIPE X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=a05f7804aa49e0f514f4f1cf7e0dcd9fcfcddfac;p=patchyircd.git use sigaction to set handler for SIGPIPE --- diff --git a/main.c b/main.c index c00c1ac..39bafd5 100644 --- a/main.c +++ b/main.c @@ -19,7 +19,10 @@ static void set_handler() sa.sa_flags = SA_RESETHAND; // only run it once if (sigaction(SIGINT, &sa, NULL) == -1) perror("sigaction"); - signal(SIGPIPE, SIG_IGN); + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_RESTART; + if (sigaction(SIGPIPE, &sa, NULL) == -1) + perror("sigaction"); } #else static int is_running = 1;