Skip to content

Commit 1b09c5a

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge 'mingw-safer-compat-poll'
This was pull request #1003 from shoelzer/master poll: Use GetTickCount64 to avoid wraparound issues Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 0437d18 + 78af82a commit 1b09c5a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

compat/poll/poll.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,20 @@ win32_compute_revents_socket (SOCKET h, int sought, long lNetworkEvents)
269269
return happened;
270270
}
271271

272+
#include <windows.h>
273+
#include "compat/win32/lazyload.h"
274+
275+
static ULONGLONG CompatGetTickCount64(void)
276+
{
277+
DECLARE_PROC_ADDR(kernel32.dll, ULONGLONG, GetTickCount64, void);
278+
279+
if (!INIT_PROC_ADDR(GetTickCount64))
280+
return (ULONGLONG)GetTickCount();
281+
282+
return GetTickCount64();
283+
}
284+
#define GetTickCount64 CompatGetTickCount64
285+
272286
#else /* !MinGW */
273287

274288
/* Convert select(2) returned fd_sets into poll(2) revents values. */

0 commit comments

Comments
 (0)