diff options
Diffstat (limited to 'tests/libtest/lib591.c')
-rw-r--r-- | tests/libtest/lib591.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/libtest/lib591.c b/tests/libtest/lib591.c index 8a55e2cd1..5cd4644e3 100644 --- a/tests/libtest/lib591.c +++ b/tests/libtest/lib591.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,6 +23,10 @@ /* lib591 is used for test cases 591, 592, 593 and 594 */ +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + #include <fcntl.h> #include "testutil.h" @@ -112,8 +116,9 @@ int test(char *URL) /* At this point, timeout is guaranteed to be greater or equal than -1. */ if(timeout != -1L) { - interval.tv_sec = timeout/1000; - interval.tv_usec = (timeout%1000)*1000; + int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout; + interval.tv_sec = itimeout/1000; + interval.tv_usec = (itimeout%1000)*1000; } else { interval.tv_sec = 0; |