poll: use GetTickCount64() to avoid wrap-around issues
commite8dfcace316aaaca226c2ae2d268bcc4d3131b38
authorSteve Hoelzer <shoelzer@gmail.com>
Wed, 31 Oct 2018 21:11:36 +0000 (31 14:11 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 5 Nov 2018 04:02:42 +0000 (5 13:02 +0900)
tree8baa89194ed437fdaf34c0eed80241d080afc219
parent4ede3d42dfb57f9a41ac96a1f216c62eb7566cc2
poll: use GetTickCount64() to avoid wrap-around issues

The value of timeout starts as an int value, and for this reason it
cannot overflow unsigned long long aka ULONGLONG. The unsigned version
of this initial value is available in orig_timeout. The difference
(orig_timeout - elapsed) cannot wrap around because it is protected by
a conditional (as can be seen in the patch text). Hence, the ULONGLONG
difference can only have values that are smaller than the initial
timeout value and truncation to int cannot overflow.

Signed-off-by: Steve Hoelzer <shoelzer@gmail.com>
[j6t: improved both implementation and log message]
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/poll/poll.c