aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib540.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libtest/lib540.c')
-rw-r--r--tests/libtest/lib540.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c
index a47f1dee6..ac0ebe60b 100644
--- a/tests/libtest/lib540.c
+++ b/tests/libtest/lib540.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
@@ -30,6 +30,10 @@
#include "test.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
#include "testutil.h"
#include "warnless.h"
#include "memdebug.h"
@@ -139,8 +143,9 @@ static int loop(int num, CURLM *cm, const char* url, const char* userpwd,
/* At this point, L is guaranteed to be greater or equal than -1. */
if(L != -1) {
- T.tv_sec = L/1000;
- T.tv_usec = (L%1000)*1000;
+ int itimeout = (L > (long)INT_MAX) ? INT_MAX : (int)L;
+ T.tv_sec = itimeout/1000;
+ T.tv_usec = (itimeout%1000)*1000;
}
else {
T.tv_sec = 5;