Skip to content

Commit

Permalink
lib: Ensure tv_r gets set in io_loop_get_wait_time
Browse files Browse the repository at this point in the history
If this does not get reset here to 0 it can cause
errors or unpredictable behaviour in select/kqueue
polling, such as very long delays.
  • Loading branch information
cmouse committed Oct 24, 2016
1 parent 9faac59 commit 3e41b3d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/ioloop.c
Expand Up @@ -422,6 +422,8 @@ int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r)
if (gettimeofday(&tv_now, NULL) < 0)
i_fatal("gettimeofday(): %m");
msecs = 0;
tv_r->tv_sec = 0;
tv_r->tv_usec = 0;
} else {
tv_now.tv_sec = 0;
msecs = timeout_get_wait_time(timeout, tv_r, &tv_now);
Expand Down

0 comments on commit 3e41b3d

Please sign in to comment.