From dd646df40136ef6d795591490c0abadb882bafb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Sat, 24 Dec 2022 01:14:51 -0500 Subject: [PATCH] Switch to sigaction() from signal();siginterrupt() It seems Linux has deprecated siginterrupt(), and they've been aggressive about removing deprecated C functions lately. --- src/sbbs3/jsexec.c | 13 +++++++------ src/syncterm/conn.h | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/sbbs3/jsexec.c b/src/sbbs3/jsexec.c index 5558f9a507..c650f8799b 100644 --- a/src/sbbs3/jsexec.c +++ b/src/sbbs3/jsexec.c @@ -1197,6 +1197,9 @@ int main(int argc, char **argv, char** env) FILE* fp; char ini_fname[MAX_PATH + 1]; str_list_t ini = NULL; +#ifdef __unix__ + struct sigaction sa = {0}; +#endif confp=stdout; errfp=stderr; @@ -1485,12 +1488,10 @@ int main(int argc, char **argv, char** env) #if defined(_WIN32) SetConsoleCtrlHandler(ControlHandler, TRUE /* Add */); #elif defined(__unix__) - signal(SIGQUIT,break_handler); - siginterrupt(SIGQUIT, 1); - signal(SIGINT,break_handler); - siginterrupt(SIGINT, 1); - signal(SIGTERM,break_handler); - siginterrupt(SIGTERM, 1); + sa.sa_handler = break_handler; + sigaction(SIGQUIT, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); signal(SIGHUP,recycle_handler); diff --git a/src/syncterm/conn.h b/src/syncterm/conn.h index bbb95736cf..8b68d8d6a4 100644 --- a/src/syncterm/conn.h +++ b/src/syncterm/conn.h @@ -5,6 +5,8 @@ #ifndef _CONN_H_ #define _CONN_H_ +#include <stdbool.h> + #include "sockwrap.h" #include "threadwrap.h" -- GitLab