mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-09 20:58:44 +00:00
Log: Reinitialize the static logging structures
The static logging structures are reused, we need to reinitialize them otherwise add_tail() would fail in debug build. Reinitializing these structures should be fine as the list they belong to is being reinitialized on entry to the very same function. Thanks to Andreas Rammhold and Mikael Magnusson for patches.
This commit is contained in:
parent
30b8468269
commit
0ef082c51e
@ -341,7 +341,11 @@ default_log_list(int initial, const char **syslog_name)
|
|||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
if (!dbgf)
|
if (!dbgf)
|
||||||
{
|
{
|
||||||
static struct log_config lc_syslog = { .mask = ~0 };
|
static struct log_config lc_syslog;
|
||||||
|
lc_syslog = (struct log_config){
|
||||||
|
.mask = ~0
|
||||||
|
};
|
||||||
|
|
||||||
add_tail(&log_list, &lc_syslog.n);
|
add_tail(&log_list, &lc_syslog.n);
|
||||||
*syslog_name = bird_name;
|
*syslog_name = bird_name;
|
||||||
}
|
}
|
||||||
@ -349,15 +353,24 @@ default_log_list(int initial, const char **syslog_name)
|
|||||||
|
|
||||||
if (dbgf && (dbgf != stderr))
|
if (dbgf && (dbgf != stderr))
|
||||||
{
|
{
|
||||||
static struct log_config lc_debug = { .mask = ~0 };
|
static struct log_config lc_debug;
|
||||||
lc_debug.fh = dbgf;
|
lc_debug = (struct log_config){
|
||||||
|
.mask = ~0,
|
||||||
|
.fh = dbgf
|
||||||
|
};
|
||||||
|
|
||||||
add_tail(&log_list, &lc_debug.n);
|
add_tail(&log_list, &lc_debug.n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initial || (dbgf == stderr))
|
if (initial || (dbgf == stderr))
|
||||||
{
|
{
|
||||||
static struct log_config lc_stderr = { .mask = ~0, .terminal_flag = 1};
|
static struct log_config lc_stderr;
|
||||||
lc_stderr.fh = stderr;
|
lc_stderr = (struct log_config){
|
||||||
|
.mask = ~0,
|
||||||
|
.terminal_flag = 1,
|
||||||
|
.fh = stderr
|
||||||
|
};
|
||||||
|
|
||||||
add_tail(&log_list, &lc_stderr.n);
|
add_tail(&log_list, &lc_stderr.n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user