]> PatchyGit - patchyircd.git/commitdiff
use sigaction to set handler for SIGPIPE
authorEgor <egor@patchysicp.xyz>
Wed, 18 Oct 2023 20:08:20 +0000 (23:08 +0300)
committerEgor <egor@patchysicp.xyz>
Wed, 18 Oct 2023 20:08:20 +0000 (23:08 +0300)
main.c

diff --git a/main.c b/main.c
index c00c1ac..39bafd5 100644 (file)
--- 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;