summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2015-12-29 17:51:56 +0000
committerbluhm <bluhm@openbsd.org>2015-12-29 17:51:56 +0000
commit316abc9440c2d6cfdbe0edc306a005b1c81d6945 (patch)
treea97ed947063beb111418d9e4dd717d08287da509 /usr.sbin/syslogd
parentshuffle tx code slightly and mark bge_start as mpsafe. (diff)
downloadwireguard-openbsd-316abc9440c2d6cfdbe0edc306a005b1c81d6945.tar.xz
wireguard-openbsd-316abc9440c2d6cfdbe0edc306a005b1c81d6945.zip
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/syslogd')
-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;