aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib591.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/lib591.c
parentfe2b2a3b9dbe18883cf7c9789cd958915978dc3a (diff)
libtest: fix some compiler warnings
Diffstat (limited to 'tests/libtest/lib591.c')
-rw-r--r--tests/libtest/lib591.c11
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;