]> granicus.if.org Git - curl/commitdiff
hostip.c: return immediately from Curl_resolv_timeout() upon expired timeout.
authorYang Tse <yangsita@gmail.com>
Thu, 1 Sep 2011 15:09:46 +0000 (17:09 +0200)
committerYang Tse <yangsita@gmail.com>
Thu, 1 Sep 2011 15:09:46 +0000 (17:09 +0200)
Ensure existing logic in Curl_resolv_timeout() is not subverted upon getting a
negative timeout from resolve_server(). The timeout in resolve_server() could
be checked to avoid calling Curl_resolv_timeout() with an expired timeout, but
fixing this in this way allows existing logic in resolve_server() to be kept
unchanged.

lib/hostip.c

index e857dced4ac06054e1d24db202541fb3ee217ae4..d261a163a438a2d3830ff41125fdb6e6ff111b51 100644 (file)
@@ -554,6 +554,10 @@ int Curl_resolv_timeout(struct connectdata *conn,
 
   *entry = NULL;
 
+  if(timeoutms < 0)
+    /* got an already expired timeout */
+    return CURLRESOLV_TIMEDOUT;
+
 #ifdef USE_ALARM_TIMEOUT
   if(data->set.no_signal)
     /* Ignore the timeout when signals are disabled */