diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-11-25 15:15:13 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2020-11-25 15:15:13 +0100 |
commit | 62d57b9bdf82cc978f889f0118c8aa19ae999a3d (patch) | |
tree | f498f972fdd9f4310ff884b928482af31e688268 /sysdep/unix | |
parent | 0ef082c51e5d905e9137e1484036b9d9b32e9a75 (diff) |
Log: Fix locking during log reconfiguration
The log subsystem should be locked earlier, as default_log_list() may
internally manipulate with the current_log_list (if it is also a default
log list).
Diffstat (limited to 'sysdep/unix')
-rw-r--r-- | sysdep/unix/log.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index 44536cc9..14d18c01 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -382,12 +382,12 @@ log_switch(int initial, list *logs, const char *new_syslog_name) { struct log_config *l; + /* We should not manipulate with log list when other threads may use it */ + log_lock(); + if (!logs || EMPTY_LIST(*logs)) logs = default_log_list(initial, &new_syslog_name); - /* We shouldn't close the logs when other threads may use them */ - log_lock(); - /* Close the logs to avoid pinning them on disk when deleted */ if (current_log_list) WALK_LIST(l, *current_log_list) |