curl_multi_wait: accept 0 from multi_timeout() as valid timeout

The code rejected 0 as a valid timeout while in fact the function could
indeed legitimately return that and it should be respected.

Reported-by: Bjorn Stenberg
This commit is contained in:
Daniel Stenberg
2013-10-30 23:48:08 +01:00
parent cfdfdcdd9d
commit 753d44fa00

View File

@@ -787,9 +787,9 @@ CURLMcode curl_multi_wait(CURLM *multi_handle,
/* If the internally desired timeout is actually shorter than requested from /* If the internally desired timeout is actually shorter than requested from
the outside, then use the shorter time! But only if the internal timer the outside, then use the shorter time! But only if the internal timer
is actually larger than 0! */ is actually larger than -1! */
(void)multi_timeout(multi, &timeout_internal); (void)multi_timeout(multi, &timeout_internal);
if((timeout_internal > 0) && (timeout_internal < (long)timeout_ms)) if((timeout_internal >= 0) && (timeout_internal < (long)timeout_ms))
timeout_ms = (int)timeout_internal; timeout_ms = (int)timeout_internal;
/* Count up how many fds we have from the multi handle */ /* Count up how many fds we have from the multi handle */