summaryrefslogtreecommitdiffstats
path: root/ulogd/extensions/ulogd_SYSLOG.c
diff options
context:
space:
mode:
authorlaforge <laforge>2004-04-24 22:50:55 +0000
committerlaforge <laforge>2004-04-24 22:50:55 +0000
commit7b452633ae269422d8e4460d145b6eb93724a4ca (patch)
tree61909597c3382c65ae1502d45eca6ab3dbd7a96b /ulogd/extensions/ulogd_SYSLOG.c
parentab32a1519424cdb54bfb690ee20e0c05fba38a83 (diff)
- add .init and .fini member to output plugin
- defer file opens + other initialization until after setuid() was called - cosmetic cleanup (no _ in static functions, use 'static' whenever possible)
Diffstat (limited to 'ulogd/extensions/ulogd_SYSLOG.c')
-rw-r--r--ulogd/extensions/ulogd_SYSLOG.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/ulogd/extensions/ulogd_SYSLOG.c b/ulogd/extensions/ulogd_SYSLOG.c
index 1be22d7..cb87fa9 100644
--- a/ulogd/extensions/ulogd_SYSLOG.c
+++ b/ulogd/extensions/ulogd_SYSLOG.c
@@ -57,7 +57,7 @@ static config_entry_t level_ce = {
static int syslog_level, syslog_facility;
-int _output_syslog(ulog_iret_t *res)
+static int _output_syslog(ulog_iret_t *res)
{
static char buf[4096];
@@ -67,11 +67,8 @@ int _output_syslog(ulog_iret_t *res)
return 0;
}
-static ulog_output_t syslog_op = { NULL, "syslog", &_output_syslog, NULL };
-
-void _init(void)
+static int syslog_init(void)
{
-
/* FIXME: error handling */
config_parse_file("SYSLOG", &level_ce);
@@ -125,6 +122,26 @@ void _init(void)
exit(2);
}
+ openlog("ulogd", LOG_NDELAY|LOG_PID, syslog_facility);
+
+ return 0;
+}
+
+static void syslog_fini(void)
+{
+ closelog();
+}
+
+static ulog_output_t syslog_op = {
+ .name = "syslog",
+ .init = &syslog_init,
+ .fini = &syslog_fini,
+ .output &_output_syslog
+};
+
+
+void _init(void)
+{
if (printpkt_init())
ulogd_log(ULOGD_ERROR, "can't resolve all keyhash id's\n");