From 6f77ba8aeaeefc3d1035f9dfbc456161642e5d8c Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 14 Apr 2019 09:15:03 +1000 Subject: [PATCH] [client] perform proper shutdown on SIGTERM --- VERSION | 2 +- client/src/main.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index bb71f1ec..a3ee9c51 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -a12-155-g8cedad8241+1 \ No newline at end of file +a12-157-g972ff93e6c+1 \ No newline at end of file diff --git a/client/src/main.c b/client/src/main.c index 3496262d..d01e8aee 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -845,11 +845,13 @@ int eventFilter(void * userdata, SDL_Event * event) return 0; } -void intHandler(int signal) +void int_handler(int signal) { switch(signal) { case SIGINT: + case SIGTERM: + DEBUG_INFO("Caught signal, shutting down..."); state.running = false; break; } @@ -986,7 +988,8 @@ int run() // override SDL's SIGINIT handler so that we can tell the difference between // SIGINT and the user sending a close event, such as ALT+F4 - signal(SIGINT, intHandler); + signal(SIGINT , int_handler); + signal(SIGTERM, int_handler); LG_RendererParams lgrParams; lgrParams.showFPS = params.showFPS;