Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 16:37:24 +0300
committerJunio C Hamano <gitster@pobox.com>2018-11-13 16:37:24 +0300
commit1961efecae1ef937aa1d571add4eae03a8c8303b (patch)
treec0701a8277680f3edcdf6efca5d8ff928cd0f6a1 /compat
parent6e31fa9cc263ee6a65123fbe47dfc87592adcfb0 (diff)
parente8dfcace316aaaca226c2ae2d268bcc4d3131b38 (diff)
Merge branch 'sh/mingw-safer-compat-poll'
Windows fix. * sh/mingw-safer-compat-poll: poll: use GetTickCount64() to avoid wrap-around issues
Diffstat (limited to 'compat')
-rw-r--r--compat/poll/poll.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index ad5dcde439d..4459408c7d0 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -18,6 +18,9 @@
You should have received a copy of the GNU General Public License along
with this program; if not, see <http://www.gnu.org/licenses/>. */
+/* To bump the minimum Windows version to Windows Vista */
+#include "git-compat-util.h"
+
/* Tell gcc not to warn about the (nfd < 0) tests, below. */
#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
# pragma GCC diagnostic ignored "-Wtype-limits"
@@ -449,7 +452,8 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
static HANDLE hEvent;
WSANETWORKEVENTS ev;
HANDLE h, handle_array[FD_SETSIZE + 2];
- DWORD ret, wait_timeout, nhandles, start = 0, elapsed, orig_timeout = 0;
+ DWORD ret, wait_timeout, nhandles, orig_timeout = 0;
+ ULONGLONG start = 0;
fd_set rfds, wfds, xfds;
BOOL poll_again;
MSG msg;
@@ -465,7 +469,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)
if (timeout != INFTIM)
{
orig_timeout = timeout;
- start = GetTickCount();
+ start = GetTickCount64();
}
if (!hEvent)
@@ -614,8 +618,8 @@ restart:
if (!rc && orig_timeout && timeout != INFTIM)
{
- elapsed = GetTickCount() - start;
- timeout = elapsed >= orig_timeout ? 0 : orig_timeout - elapsed;
+ ULONGLONG elapsed = GetTickCount64() - start;
+ timeout = elapsed >= orig_timeout ? 0 : (int)(orig_timeout - elapsed);
}
if (!rc && timeout)