From c45c40385e07ccc067a67d408131682767015b80 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 23 Sep 2008 08:46:30 +0200 Subject: [PATCH] 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 as long as poll() does not need to wait on file descriptors as well because in this case the call just amounts to Sleep(). This is needed if the user sets help.autocorrect is set to a positive value. Signed-off-by: Johannes Sixt --- compat/mingw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compat/mingw.c b/compat/mingw.c index ccfa2a0a3d..7eed60db1b 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -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