Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select: always use Sleep in Curl_wait_ms on Win32 #5489

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 6 additions & 14 deletions lib/select.c
Expand Up @@ -86,18 +86,18 @@ int Curl_wait_ms(timediff_t timeout_ms)
}
#if defined(MSDOS)
delay(timeout_ms);
#elif defined(USE_WINSOCK)
#elif defined(WIN32)
/* prevent overflow, timeout_ms is typecast to ULONG/DWORD. */
#if TIMEDIFF_T_MAX > ULONG_MAX
if(timeout_ms > ULONG_MAX)
#if ULONG_MAX < INFINITE
timeout_ms = ULONG_MAX;
#else
timeout_ms = ULONG_MAX-1;
/* avoid waiting forever */
#endif
#endif
/* avoid INFINITE, negated check to not care about > or >= due to max */
#if INFINITE > 0
if(!(timeout_ms < INFINITE))
timeout_ms = INFINITE-1;
mback2k marked this conversation as resolved.
Show resolved Hide resolved
Sleep((ULONG)timeout_ms);
#endif
#else
#if defined(HAVE_POLL_FINE)
/* prevent overflow, timeout_ms is typecast to int. */
Expand All @@ -119,14 +119,6 @@ int Curl_wait_ms(timediff_t timeout_ms)
#endif
pending_tv.tv_sec = (time_t)tv_sec;
pending_tv.tv_usec = (suseconds_t)tv_usec;
#elif defined(WIN32) /* maybe also others in the future */
#if TIMEDIFF_T_MAX > LONG_MAX
/* tv_sec overflow check on Windows there we know it is long */
if(tv_sec > LONG_MAX)
tv_sec = LONG_MAX;
#endif
pending_tv.tv_sec = (long)tv_sec;
pending_tv.tv_usec = (long)tv_usec;
#else
#if TIMEDIFF_T_MAX > INT_MAX
/* tv_sec overflow check in case time_t is signed */
Expand Down