select tests: Safer way of handling timeout.
authorBruno Haible <bruno@clisp.org>
Mon, 27 Dec 2010 17:52:47 +0000 (18:52 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 27 Dec 2010 17:52:47 +0000 (18:52 +0100)
* tests/test-select.c (do_select_nowait): Zero-initialize the timeout
at every invocation.

ChangeLog
tests/test-select.c

index 48c15b0d83b6951a1072e8ba1983c756235d37ca..f9a3dc7c75cbbaf15d4abb617b1324500341e57a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 2d4f9965abc5098af7a22a4264c666889a45f969..365d1d2b9ed4fb49d26ad1ad2098fa21f6a10ade 100644 (file)
@@ -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);
 }