aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib597.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-12-05 17:28:32 +0100
committerYang Tse <yangsita@gmail.com>2012-12-05 17:28:32 +0100
commit60edbf65b6d1bfd264e10a72cd35fb81bfad7b8d (patch)
treeaa0b83f21e9d90bca434bcbf79456a9704d746f0 /tests/libtest/lib597.c
parentfe2b2a3b9dbe18883cf7c9789cd958915978dc3a (diff)
libtest: fix some compiler warnings
Diffstat (limited to 'tests/libtest/lib597.c')
-rw-r--r--tests/libtest/lib597.c11
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;