X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/aaa245280785370d9ed8424cb6e0a50fd7eb23da..5538c5782135666d73f7615a37ea9689afa07dcd:/cleanup.c?ds=inline 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; }