diff options
Diffstat (limited to 'tests/libtest/lib597.c')
-rw-r--r-- | tests/libtest/lib597.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/libtest/lib597.c b/tests/libtest/lib597.c index 6a5ee4f8f..a27cefd5b 100644 --- a/tests/libtest/lib597.c +++ b/tests/libtest/lib597.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 @@ -21,6 +21,10 @@ ***************************************************************************/ #include "test.h" +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + #include "testutil.h" #include "warnless.h" #include "memdebug.h" @@ -113,8 +117,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 = TEST_HANG_TIMEOUT/1000+1; |