summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2009-04-17 23:33:30 +0000
committeremax <emax@FreeBSD.org>2009-04-17 23:33:30 +0000
commitd771ed46cf47da009c6516f573b1ce658ee0d21a (patch)
tree716e6fab84a47e1c4e2d68e25440f14da7c3b727 /usr.sbin
parentf21e914b37ae56dcf4fda2a714a084b3ece37aee (diff)
downloadFreeBSD-src-d771ed46cf47da009c6516f573b1ce658ee0d21a.zip
FreeBSD-src-d771ed46cf47da009c6516f573b1ce658ee0d21a.tar.gz
Fix bug in event timeout handling
Submitted by: mav MFC after: 3 days
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bluetooth/btpand/event.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/bluetooth/btpand/event.c b/usr.sbin/bluetooth/btpand/event.c
index 253084e..159f90c 100644
--- a/usr.sbin/bluetooth/btpand/event.c
+++ b/usr.sbin/bluetooth/btpand/event.c
@@ -110,12 +110,12 @@ __event_dispatch(void)
event_del(ev);
if (ev->flags & EV_HAS_TIMEOUT) {
- t = now;
-
- if (tv_cmp(&t, &ev->expire) <= 0)
+ if (tv_cmp(&now, &ev->expire) >= 0)
t.tv_sec = t.tv_usec = 0;
- else
- tv_sub(&t, &ev->expire);
+ else {
+ t = ev->expire;
+ tv_sub(&t, &now);
+ }
if (tv_cmp(&t, &timeout) < 0)
timeout = t;
OpenPOWER on IntegriCloud