From a05f7804aa49e0f514f4f1cf7e0dcd9fcfcddfac Mon Sep 17 00:00:00 2001 From: Egor Date: Wed, 18 Oct 2023 23:08:20 +0300 Subject: [PATCH] use sigaction to set handler for SIGPIPE --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.56.0