diff options
author | Maria Matejka <mq@ucw.cz> | 2019-07-30 12:11:12 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2019-07-30 12:13:38 +0200 |
commit | d72d3891bf262b28cd4d03fd72e88bf37fef112a (patch) | |
tree | 19fd60793a2939b0f5b798ffc9453a1e538f6175 | |
parent | 46faedff2990ca3e065931b36ab2133b3633bd25 (diff) |
Log: Fixed race condition in reconfigure while BFD is running
-rw-r--r-- | sysdep/unix/log.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index 22291dc1..034861f8 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -294,12 +294,14 @@ log_switch(int debug, list *l, char *new_syslog_name) if (!l || EMPTY_LIST(*l)) l = default_log_list(debug, !l, &new_syslog_name); + log_lock(); + current_log_list = l; #ifdef HAVE_SYSLOG_H if (current_syslog_name && new_syslog_name && !strcmp(current_syslog_name, new_syslog_name)) - return; + goto done; if (current_syslog_name) { @@ -314,6 +316,9 @@ log_switch(int debug, list *l, char *new_syslog_name) openlog(current_syslog_name, LOG_CONS | LOG_NDELAY, LOG_DAEMON); } #endif + +done: + log_unlock(); } |