From 7b67cfd1efb3096a66871fe7d495f2617df576ff Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Thu, 2 Mar 2017 13:32:20 +0200 Subject: [PATCH] Variables written to in signal handlers should be volatile --- server/core/gateway.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/core/gateway.cc b/server/core/gateway.cc index a324b607f..a0a188c37 100644 --- a/server/core/gateway.cc +++ b/server/core/gateway.cc @@ -143,7 +143,7 @@ static struct option long_options[] = static bool syslog_configured = false; static bool maxlog_configured = false; static bool log_to_shm_configured = false; -static int last_signal = 0; +static volatile sig_atomic_t last_signal = 0; static int cnf_preparser(void* data, const char* section, const char* name, const char* value); static void log_flush_shutdown(void); @@ -381,7 +381,7 @@ sigchld_handler (int i) } } -int fatal_handling = 0; +volatile sig_atomic_t fatal_handling = 0; static int signal_set(int sig, void (*handler)(int)); @@ -405,12 +405,12 @@ sigfatal_handler(int i) { void *addrs[128]; - int n, count = backtrace(addrs, 128); + int count = backtrace(addrs, 128); char** symbols = backtrace_symbols(addrs, count); if (symbols) { - for (n = 0; n < count; n++) + for (int n = 0; n < count; n++) { MXS_ALERT(" %s\n", symbols[n]); }