summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2015-10-16 02:09:31 +0000
committertedu <tedu@openbsd.org>2015-10-16 02:09:31 +0000
commit58bd32cad725f8d235fb4b57a7c5ef68235a7f37 (patch)
tree15c82b2a0a03db8abd92808023cd3fecd7d32256
parentsimplify logging functions. once a daemon, always a daemon (diff)
downloadwireguard-openbsd-58bd32cad725f8d235fb4b57a7c5ef68235a7f37.tar.xz
wireguard-openbsd-58bd32cad725f8d235fb4b57a7c5ef68235a7f37.zip
fine tune the logging some more
-rw-r--r--usr.sbin/rebound/rebound.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/rebound/rebound.c b/usr.sbin/rebound/rebound.c
index 384d236cac7..c8b155cac0c 100644
--- a/usr.sbin/rebound/rebound.c
+++ b/usr.sbin/rebound/rebound.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rebound.c,v 1.18 2015/10/16 01:58:28 tedu Exp $ */
+/* $OpenBSD: rebound.c,v 1.19 2015/10/16 02:09:31 tedu Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -381,6 +381,7 @@ launch(const char *confname, int ud, int ld, int kq)
EV_SET(&kev[2], SIGHUP, EVFILT_SIGNAL, EV_ADD, 0, 0, NULL);
kevent(kq, kev, 3, NULL, 0, NULL);
signal(SIGHUP, SIG_IGN);
+ logmsg(LOG_INFO, "worker process going to work");
while (1) {
r = kevent(kq, NULL, 0, kev, 4, timeout);
if (r == -1)
@@ -390,6 +391,7 @@ launch(const char *confname, int ud, int ld, int kq)
for (i = 0; i < r; i++) {
if (kev[i].filter == EVFILT_SIGNAL) {
+ logmsg(LOG_INFO, "hupped, exiting");
exit(0);
} else if (kev[i].ident == ud) {
req = newrequest(ud,
@@ -495,6 +497,8 @@ main(int argc, char **argv)
if (argc)
usage();
+ openlog("rebound", LOG_PID | LOG_NDELAY, LOG_DAEMON);
+
if (!debug)
daemon(0, 0);
@@ -547,6 +551,9 @@ main(int argc, char **argv)
/* wait for something to happen: HUP or child exiting */
while (1) {
r = kevent(kq, NULL, 0, &kev, 1, timeout);
+ if (r == -1)
+ logerr("kevent failed (%d)", errno);
+
if (r == 0) {
logerr("child died without HUP");
} else if (kev.filter == EVFILT_SIGNAL) {