summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-12-23 16:40:44 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-12-23 16:40:44 +0000
commit6f1441ea379721191626c9169af2ee22fe537bc1 (patch)
treed912b23a96d85e3240c44c8e265ea26f381871c2 /usr.sbin/bgpd
parentfb27cdf6dee7a4a17a4bf6921388d3112ed189af (diff)
make all timer_get() callers (except timer_set which will need
special handling) and onein session.c that will go away able to cope with timer_get() returning NULL (i.e.nosuch timer/not running)
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/timer.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/timer.c b/usr.sbin/bgpd/timer.c
index 07c89bc29c1..5d5cd25b7b5 100644
--- a/usr.sbin/bgpd/timer.c
+++ b/usr.sbin/bgpd/timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timer.c,v 1.1 2007/12/20 17:08:48 henning Exp $ */
+/* $OpenBSD: timer.c,v 1.2 2007/12/23 16:40:43 henning Exp $ */
/*
* Copyright (c) 2003-2007 Henning Brauer <henning@openbsd.org>
@@ -48,7 +48,7 @@ timer_due(struct peer *p, enum Timer timer)
{
time_t *t = timer_get(p, timer);
- if (*t > 0 && *t <= time(NULL))
+ if (t != NULL && *t > 0 && *t <= time(NULL))
return (1);
return (0);
}
@@ -58,9 +58,11 @@ timer_running(struct peer *p, enum Timer timer, time_t *left)
{
time_t *t = timer_get(p, timer);
- *left = *t - time(NULL);
- if (*t > 0)
+ if (t != NULL && *t > 0) {
+ if (left != NULL)
+ *left = *t - time(NULL);
return (1);
+ }
return (0);
}
@@ -77,5 +79,6 @@ timer_stop(struct peer *p, enum Timer timer)
{
time_t *t = timer_get(p, timer);
- *t = 0;
+ if (t != NULL)
+ *t = 0;
}