From 2a29f3439cafe9cafb0aa706466f99230d5d07d3 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 5 Nov 2013 12:00:40 +0100 Subject: handle SIGINT and print variable text --- pacredir.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pacredir.c b/pacredir.c index 4ddf9e8..5c4b9d4 100644 --- a/pacredir.c +++ b/pacredir.c @@ -399,9 +399,9 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection, const char * return ret; } -/*** sigterm_callback ***/ -void sigterm_callback(int signal) { - write_log(stdout, "Received SIGTERM, quitting.\n"); +/*** sig_callback ***/ +void sig_callback(int signal) { + write_log(stdout, "Received signal '%s', quitting.\n", strsignal(signal)); avahi_simple_poll_quit(simple_poll); } @@ -535,7 +535,8 @@ int main(int argc, char ** argv) { } /* register signal callbacks */ - signal(SIGTERM, sigterm_callback); + signal(SIGTERM, sig_callback); + signal(SIGINT, sig_callback); signal(SIGHUP, sighup_callback); /* run the main loop */ -- cgit v1.2.3-70-g09d2