aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs/sgsn_main.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-20 20:50:06 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 17:40:56 +0200
commit6f750e63b03073fd06744bf77df0d25823c3552d (patch)
treee95c3b960dee8291e616c637a868327979904dfb /src/gprs/sgsn_main.c
parentb1c1a7676ab8dc9287f10ccc2936d5180f8478dd (diff)
Treat SIGTERM just like SIGINT in our programs
When somebody kills the process, it's best to handle the signal and to use the opportunity for some cleanup. We always did this in the NITB on SIGINT, but never on SIGTERM. Let's change it. Change-Id: Iea6804325a6575ceab5edfd28dd20249462f143b
Diffstat (limited to 'src/gprs/sgsn_main.c')
-rw-r--r--src/gprs/sgsn_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index 71cb18c9..d5d43ad2 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -145,6 +145,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
+ case SIGTERM:
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
@@ -332,6 +333,7 @@ int main(int argc, char **argv)
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
signal(SIGINT, &signal_handler);
+ signal(SIGTERM, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);