aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/osmo_bsc_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 03:52:47 +0200
commit8f4a7c14af338180ecd67cbabaf04fe2e7321596 (patch)
treebd3ef86942ac6aeb7e5375a6aecbf3509ca67081 /src/osmo-bsc/osmo_bsc_main.c
parent5d35245adc2555744600720ad90bb4e3a08605f7 (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/osmo-bsc/osmo_bsc_main.c')
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index ee094d670..90651b95e 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -162,6 +162,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
+ case SIGTERM:
bsc_shutdown_net(bsc_gsmnet);
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(3);
@@ -280,6 +281,7 @@ int main(int argc, char **argv)
}
signal(SIGINT, &signal_handler);
+ signal(SIGTERM, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);