aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-10-26 15:24:50 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-10-28 10:40:51 +0200
commit0d85eed3dfbbce18303900385d17f84d939cef00 (patch)
treee86f91d28fd31de4cc625fc1db9e2650f5feef11 /lib/connect.c
parent9dfc541dd7d11870d51b69c93083b805de30239f (diff)
Curl_timeleft: change return type to timediff_t
returning 'time_t' is problematic when that type is unsigned and we return values less than zero to signal "already expired", used in several places in the code. Closes #2021
Diffstat (limited to 'lib/connect.c')
-rwxr-xr-xlib/connect.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 5f545f230..787026942 100755
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -179,12 +179,12 @@ singleipconnect(struct connectdata *conn,
*
* @unittest: 1303
*/
-time_t Curl_timeleft(struct Curl_easy *data,
- struct curltime *nowp,
- bool duringconnect)
+timediff_t Curl_timeleft(struct Curl_easy *data,
+ struct curltime *nowp,
+ bool duringconnect)
{
int timeout_set = 0;
- time_t timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0;
+ timediff_t timeout_ms = duringconnect?DEFAULT_CONNECT_TIMEOUT:0;
struct curltime now;
/* if a timeout is set, use the most restrictive one */
@@ -1148,7 +1148,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
struct curltime before = Curl_now();
CURLcode result = CURLE_COULDNT_CONNECT;
- time_t timeout_ms = Curl_timeleft(data, &before, TRUE);
+ timediff_t timeout_ms = Curl_timeleft(data, &before, TRUE);
if(timeout_ms < 0) {
/* a precaution, no need to continue if time already is up */