summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-02-22 11:19:59 +0100
committerTobias Klauser <tklauser@distanz.ch>2014-02-22 11:19:59 +0100
commit752a83809f667c35cd4e8e84c7b4f380c0afd9b0 (patch)
tree39ae611ac3b36aa7edbfbced29fe19db2d183404
parent064f4eddf1facae6eb50a7d928c6b049ee4231bf (diff)
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 <tklauser@distanz.ch>
-rw-r--r--trafgen.c4
1 files changed, 4 insertions, 0 deletions
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);