summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtadvd/timer.c
diff options
context:
space:
mode:
authorrainer <rainer@openbsd.org>2008-04-21 20:40:55 +0000
committerrainer <rainer@openbsd.org>2008-04-21 20:40:55 +0000
commitb22cd8fb5fdda8fb8e1e2f5baf8f4530d2c43700 (patch)
treeb505a4324b5c251d292fd27f877489ba6cf6af1d /usr.sbin/rtadvd/timer.c
parentmove ieee80211_ibss_merge() from ieee80211_input.c to ieee80211_node.c (diff)
downloadwireguard-openbsd-b22cd8fb5fdda8fb8e1e2f5baf8f4530d2c43700.tar.xz
wireguard-openbsd-b22cd8fb5fdda8fb8e1e2f5baf8f4530d2c43700.zip
Clean up logging by introducing the logging API used in
other daemons and clean up the command line options. For details, see rtadvd(8). ok bluhm@, pyr@
Diffstat (limited to 'usr.sbin/rtadvd/timer.c')
-rw-r--r--usr.sbin/rtadvd/timer.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/usr.sbin/rtadvd/timer.c b/usr.sbin/rtadvd/timer.c
index 1f6249d6c0f..055b6e93d43 100644
--- a/usr.sbin/rtadvd/timer.c
+++ b/usr.sbin/rtadvd/timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timer.c,v 1.8 2002/06/10 19:57:35 espie Exp $ */
+/* $OpenBSD: timer.c,v 1.9 2008/04/21 20:40:55 rainer Exp $ */
/* $KAME: timer.c,v 1.7 2002/05/21 14:26:55 itojun Exp $ */
/*
@@ -33,11 +33,11 @@
#include <sys/time.h>
#include <unistd.h>
-#include <syslog.h>
#include <stdlib.h>
#include <string.h>
#include <search.h>
#include "timer.h"
+#include "log.h"
static struct rtadvd_timer timer_head;
@@ -63,24 +63,15 @@ rtadvd_add_timer(void (*timeout)(void *),
{
struct rtadvd_timer *newtimer;
- if ((newtimer = malloc(sizeof(*newtimer))) == NULL) {
- syslog(LOG_ERR,
- "<%s> can't allocate memory", __func__);
- exit(1);
- }
+ if ((newtimer = malloc(sizeof(*newtimer))) == NULL)
+ fatal("malloc");
memset(newtimer, 0, sizeof(*newtimer));
- if (timeout == NULL) {
- syslog(LOG_ERR,
- "<%s> timeout function unspecified", __func__);
- exit(1);
- }
- if (update == NULL) {
- syslog(LOG_ERR,
- "<%s> update function unspecified", __func__);
- exit(1);
- }
+ if (timeout == NULL)
+ fatalx("timeout function unspecified");
+ if (update == NULL)
+ fatalx("update function unspecified");
newtimer->expire = timeout;
newtimer->update = update;
newtimer->expire_data = timeodata;
@@ -165,9 +156,7 @@ rtadvd_timer_rest(struct rtadvd_timer *timer)
gettimeofday(&now, NULL);
if (TIMEVAL_LEQ(timer->tm, now)) {
- syslog(LOG_DEBUG,
- "<%s> a timer must be expired, but not yet",
- __func__);
+ log_debug("a timer must be expired, but not yet");
returnval.tv_sec = returnval.tv_usec = 0;
}
else