X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/aaa245280785370d9ed8424cb6e0a50fd7eb23da..e1385087ec060568a966a5305a9d88c24a2a0a55:/cleanup.c?ds=sidebyside diff --git a/cleanup.c b/cleanup.c index 32b997a..ecb3322 100644 --- a/cleanup.c +++ b/cleanup.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "cleanup.h" #include "keydb.h" @@ -64,17 +65,13 @@ void sig_cleanup(int signal) */ void catchsignals(void) { - struct sigaction alarmh; - logthing(LOGTHING_INFO, "Catching signals"); - memset(&alarmh, 0, sizeof(alarmh)); - alarmh.sa_handler = sig_cleanup; - sigaction(SIGALRM, &alarmh, NULL); - sigaction(SIGPIPE, &alarmh, NULL); - sigaction(SIGTERM, &alarmh, NULL); - sigaction(SIGINT, &alarmh, NULL); - sigaction(SIGHUP, &alarmh, NULL); + signal(SIGALRM, &sig_cleanup); + signal(SIGPIPE, &sig_cleanup); + signal(SIGTERM, &sig_cleanup); + signal(SIGINT, &sig_cleanup); + signal(SIGHUP, &sig_cleanup); return; }