From d4c694c810bd01334e7f15865a51388c6417d81b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 27 Dec 2010 18:52:47 +0100 Subject: [PATCH] select tests: Safer way of handling timeout. * tests/test-select.c (do_select_nowait): Zero-initialize the timeout at every invocation. --- ChangeLog | 6 ++++++ tests/test-select.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 48c15b0d8..f9a3dc7c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-12-27 Bruno Haible + select tests: Safer way of handling timeout. + * tests/test-select.c (do_select_nowait): Zero-initialize the timeout + at every invocation. + +2010-12-27 Bruno Haible + select tests: Use 'bool' where appropriate. * tests/test-select.c (connect_to_socket): Change argument type to 'bool'. diff --git a/tests/test-select.c b/tests/test-select.c index 2d4f9965a..365d1d2b9 100644 --- a/tests/test-select.c +++ b/tests/test-select.c @@ -204,7 +204,9 @@ do_select (int fd, int ev, struct timeval *tv) static int do_select_nowait (int fd, int ev) { - static struct timeval tv0; + struct timeval tv0; + tv0.tv_sec = 0; + tv0.tv_usec = 0; return do_select (fd, ev, &tv0); } -- 2.11.0