1
0
mirror of https://github.com/git/git.git synced 2024-09-28 11:11:18 +02:00

compat/mingw: Support a timeout in the poll emulation if no fds are given

Our poll() emulation did not support the timeout argument. With this patch
we support it for the simple case where poll() does not need to wait on
file descriptors as well because this case amounts to a mere Sleep().

This is needed if the user sets help.autocorrect is set to a positive
value.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Johannes Sixt 2008-09-23 08:52:16 +02:00 committed by Shawn O. Pearce
parent 07ad5a157d
commit d317851a7f

View File

@ -263,8 +263,13 @@ int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
{
int i, pending;
if (timeout != -1)
if (timeout >= 0) {
if (nfds == 0) {
Sleep(timeout);
return 0;
}
return errno = EINVAL, error("poll timeout not supported");
}
/* When there is only one fd to wait for, then we pretend that
* input is available and let the actual wait happen when the