From f2b0e71521b3d8f79d3ae71ffb31ed80096904da Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Wed, 16 Jun 2010 20:03:35 +0200 Subject: [PATCH] mainloop: Fixed possible infinite timeouts. --- ucw/mainloop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ucw/mainloop.c b/ucw/mainloop.c index d6d9c367..b87ed862 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -485,7 +485,7 @@ main_loop(void) if ((tm = clist_head(&main_timer_list)) && tm->expires < wake) wake = tm->expires; main_get_time(); - int timeout = (wake ? wake - main_now : 0); + int timeout = ((wake > main_now) ? wake - main_now : 0); DBG("MAIN: Poll for %d fds and timeout %d ms", main_file_cnt, timeout); int p = poll(main_poll_table, main_file_cnt, timeout); timestamp_t old_now = main_now; -- 2.39.2