From 14d4aeda4cf9671808aa4251489c783d58f116bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:43:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E8=87=B4=E5=8C=96signal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.c b/server.c index 833f6a2..9493004 100644 --- a/server.c +++ b/server.c @@ -585,7 +585,7 @@ static void handle_quit(int signo) { printf("Handle sigquit@%d\n", index-1); fflush(stdout); if(index) { - signal(SIGQUIT, handle_quit); + sigaction(SIGQUIT, &(const struct sigaction){handle_quit}, NULL); siglongjmp(jmp2convend[index-1], signo); } else pthread_exit(NULL); @@ -596,7 +596,7 @@ static void handle_segv(int signo) { printf("Handle sigsegv@%d\n", index-1); fflush(stdout); if(index) { - signal(SIGSEGV, handle_segv); + sigaction(SIGSEGV, &(const struct sigaction){handle_segv}, NULL); siglongjmp(jmp2convend[index-1], signo); } else pthread_exit(NULL); @@ -619,7 +619,7 @@ static void handle_pipe(int signo) { printf("Pipe error@%d, break loop...\n", index-1); fflush(stdout); if(index) { - signal(SIGPIPE, handle_pipe); + sigaction(SIGPIPE, &(const struct sigaction){handle_pipe}, NULL); siglongjmp(jmp2convend[index-1], signo); } else pthread_exit(NULL);