From eead68b7a05866ebbdf2f1f4d95303b2bd9bea6b Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sun, 29 Jun 2014 18:00:34 +0200 Subject: [PATCH] syslog plugin: Initialize syslog as soon as possible. Don't wait for the init callback to be called -- we might receive log messages earlier than that. --- src/plugins/syslog.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/plugins/syslog.c b/src/plugins/syslog.c index 02c6241..f1c3e55 100644 --- a/src/plugins/syslog.c +++ b/src/plugins/syslog.c @@ -55,13 +55,6 @@ SDB_PLUGIN_MAGIC; * plugin API */ -static int -sdb_syslog_init(sdb_object_t __attribute__((unused)) *user_data) -{ - openlog("sysdbd", LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_DAEMON); - return 0; -} /* sdb_syslog_init */ - static int sdb_syslog_log(int prio, const char *msg, sdb_object_t __attribute__((unused)) *user_data) @@ -88,7 +81,9 @@ sdb_module_init(sdb_plugin_info_t *info) sdb_plugin_set_info(info, SDB_PLUGIN_INFO_VERSION, SDB_VERSION); sdb_plugin_set_info(info, SDB_PLUGIN_INFO_PLUGIN_VERSION, SDB_VERSION); - sdb_plugin_register_init("main", sdb_syslog_init, NULL); + if (info) + openlog("sysdbd", LOG_NDELAY | LOG_NOWAIT | LOG_PID, LOG_DAEMON); + sdb_plugin_register_log("main", sdb_syslog_log, NULL); sdb_plugin_register_shutdown("main", sdb_syslog_shutdown, NULL); return 0; -- 2.30.2