changeset 14045:eb1a951e4f56

select tests: Safer way of handling timeout. * tests/test-select.c (do_select_nowait): Zero-initialize the timeout at every invocation.
author Bruno Haible <bruno@clisp.org>
date Mon, 27 Dec 2010 18:52:47 +0100
parents cf58f3c67722
children 483bac6e8bce
files ChangeLog tests/test-select.c
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 27 18:51:56 2010 +0100
+++ b/ChangeLog	Mon Dec 27 18:52:47 2010 +0100
@@ -1,3 +1,9 @@
+2010-12-27  Bruno Haible  <bruno@clisp.org>
+
+	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  <bruno@clisp.org>
 
 	select tests: Use 'bool' where appropriate.
--- a/tests/test-select.c	Mon Dec 27 18:51:56 2010 +0100
+++ b/tests/test-select.c	Mon Dec 27 18:52:47 2010 +0100
@@ -204,7 +204,9 @@
 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);
 }