if (!logs || EMPTY_LIST(*logs))
logs = default_log_list(debug, !logs, &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)
#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)
{
current_syslog_name = xstrdup(new_syslog_name);
openlog(current_syslog_name, LOG_CONS | LOG_NDELAY, LOG_DAEMON);
}
+
#endif
+
+done:
+ /* Logs exchange done, let the threads log as before */
+ log_unlock();
}