From c1f23e99c52d16ccd95bd8fab7c02e05c8f92373 Mon Sep 17 00:00:00 2001 From: mdw Date: Sat, 3 Feb 2001 19:07:08 +0000 Subject: [PATCH] Ensure that timers set to go off in the past don't case a problem. --- sel.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sel.c b/sel.c index 04d9ed5..62a61cf 100644 --- a/sel.c +++ b/sel.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: sel.c,v 1.8 2000/03/23 20:42:08 mdw Exp $ + * $Id: sel.c,v 1.9 2001/02/03 19:07:08 mdw Exp $ * * I/O multiplexing support * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: sel.c,v $ + * Revision 1.9 2001/02/03 19:07:08 mdw + * Ensure that timers set to go off in the past don't case a problem. + * * Revision 1.8 2000/03/23 20:42:08 mdw * Rearrange timeout handling to avoid list corruptions. * @@ -334,7 +337,12 @@ int sel_select(sel_state *s) if (!s->timers) a.tvp = 0; else { - TV_SUB(&a.tv, &s->timers->tv, &a.now); + if (TV_CMP(&s->timers->tv, >, &a.now)) + TV_SUB(&a.tv, &s->timers->tv, &a.now); + else { + a.tv.tv_sec = 0; + a.tv.tv_usec = 0; + } a.tvp = &a.tv; } s->args = &a; -- 2.11.0