summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-12-29 17:51:57 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-12-29 17:51:57 +0000
commit8611d61639443bbd320a6cf9909d9bad9831b3d3 (patch)
treeb6eb15e4b6bc1e71ab6711a00a41688c275fded4 /usr.sbin
parent53a2dd1f990616c07724a8c04f206f2a33ba113e (diff)
When running syslogd in debug mode, use a callback to print the
libevent messages. Before the code was removed from libevent, the library itself printed that to stderr. OK nicm@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/syslogd/syslogd.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index cf48af785de..0a9cea9f1d4 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.202 2015/12/16 13:38:39 bluhm Exp $ */
+/* $OpenBSD: syslogd.c,v 1.203 2015/12/29 17:51:56 bluhm Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -321,6 +321,7 @@ void die(int);
void markit(void);
void fprintlog(struct filed *, int, char *);
void init(void);
+void logevent(int, const char *);
void logerror(const char *);
void logerrorx(const char *);
void logerrorctx(const char *, struct tls *);
@@ -709,6 +710,8 @@ main(int argc, char *argv[])
err(1, "pledge");
/* Process is now unprivileged and inside a chroot */
+ if (Debug)
+ event_set_log_callback(logevent);
event_init();
if ((ev_ctlaccept = malloc(sizeof(struct event))) == NULL ||
@@ -2026,6 +2029,12 @@ init_signalcb(int signum, short event, void *arg)
}
void
+logevent(int severity, const char *msg)
+{
+ logdebug("libevent: [%d] %s\n", severity, msg);
+}
+
+void
logdebug(const char *fmt, ...)
{
va_list ap;