aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-11-05 12:00:40 +0100
committerGravatar Christian Hesse <mail@eworm.de>2013-11-05 12:00:40 +0100
commit2a29f3439cafe9cafb0aa706466f99230d5d07d3 (patch)
treed1fe20583007ea38f089994cabbe3c6113e6b43a
parent06466a8108415c046b5027792ebf183b39cc3c9a (diff)
downloadpacredir-2a29f3439cafe9cafb0aa706466f99230d5d07d3.tar.gz
pacredir-2a29f3439cafe9cafb0aa706466f99230d5d07d3.tar.zst
handle SIGINT and print variable text
-rw-r--r--pacredir.c9
1 files 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 */