From 752a83809f667c35cd4e8e84c7b4f380c0afd9b0 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sat, 22 Feb 2014 11:19:59 +0100 Subject: trafgen: Exit gracefully for all possible termination signals Handle all termination signals that we're allowed to handle (SIGKILL can't be handled) in order to exit gracefully in any regular termination case. Signed-off-by: Tobias Klauser --- trafgen.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trafgen.c b/trafgen.c index ea7d983..5e343e5 100644 --- a/trafgen.c +++ b/trafgen.c @@ -132,6 +132,8 @@ static void signal_handler(int number) { switch (number) { case SIGINT: + case SIGQUIT: + case SIGTERM: sigint = 1; case SIGHUP: default: @@ -1076,6 +1078,8 @@ int main(int argc, char **argv) panic("This is no networking device!\n"); register_signal(SIGINT, signal_handler); + register_signal(SIGQUIT, signal_handler); + register_signal(SIGTERM, signal_handler); register_signal(SIGHUP, signal_handler); register_signal_f(SIGALRM, timer_elapsed, SA_SIGINFO); -- cgit v1.2.3-54-g00ecf