Variables written to in signal handlers should be volatile

This commit is contained in:
Esa Korhonen 2017-03-02 13:32:20 +02:00
parent 789c14197d
commit 7b67cfd1ef

View File

@ -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]);
}