core/logging: remove thread-safe initialization guard for nm_logging_syslog_openlog()

The logging routines are not thread-safe in general, so there is no
need for trying to make nm_logging_syslog_openlog() thread-safe.
Also nm_logging_syslog_openlog() is only called by the main() routine.

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-06-02 14:04:55 +02:00
parent 7ac7249fc8
commit 48b4d0eaf2

View File

@@ -460,20 +460,18 @@ nm_log_handler (const gchar *log_domain,
void
nm_logging_syslog_openlog (gboolean debug)
{
static gsize log_handler_initialized = 0;
if (debug)
openlog (G_LOG_DOMAIN, LOG_CONS | LOG_PERROR | LOG_PID, LOG_USER);
else
openlog (G_LOG_DOMAIN, LOG_PID, LOG_DAEMON);
syslog_opened = TRUE;
if (g_once_init_enter (&log_handler_initialized)) {
if (!syslog_opened) {
syslog_opened = TRUE;
g_log_set_handler (G_LOG_DOMAIN,
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
nm_log_handler,
NULL);
g_once_init_leave (&log_handler_initialized, 1);
}
}