diff options
author | Christian Hesse <mail@eworm.de> | 2013-11-05 12:00:40 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2013-11-05 12:00:40 +0100 |
commit | 2a29f3439cafe9cafb0aa706466f99230d5d07d3 (patch) | |
tree | d1fe20583007ea38f089994cabbe3c6113e6b43a | |
parent | 06466a8108415c046b5027792ebf183b39cc3c9a (diff) | |
download | paccache-2a29f3439cafe9cafb0aa706466f99230d5d07d3.tar.gz paccache-2a29f3439cafe9cafb0aa706466f99230d5d07d3.tar.zst |
handle SIGINT and print variable text
-rw-r--r-- | pacredir.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 */ |