]> mj.ucw.cz Git - libucw.git/commitdiff
mainloop: Fixed possible infinite timeouts.
authorPavel Charvat <pchar@ucw.cz>
Wed, 16 Jun 2010 18:03:35 +0000 (20:03 +0200)
committerPavel Charvat <pchar@ucw.cz>
Wed, 16 Jun 2010 18:03:35 +0000 (20:03 +0200)
ucw/mainloop.c

index d6d9c367a495af46f48f724a4b40118390789fb2..b87ed8620108231ad47ed79a0546e723247609f3 100644 (file)
@@ -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;