aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/w32-estream.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/w32-estream.c b/src/w32-estream.c
index 8ce9419..5bb1bcf 100644
--- a/src/w32-estream.c
+++ b/src/w32-estream.c
@@ -861,11 +861,25 @@ _gpgrt_w32_poll (gpgrt_poll_t *fds, size_t nfds, int timeout)
trace_append (("%d/%c ", waitidx[i], waitinfo[i]));
trace_finish (("]"));
#endif /*ENABLE_TRACING*/
+
if (!any)
- return 0;
+ {
+ /* WFMO needs at least one object, thus we use use sleep here.
+ * INFINITE wait does not make any sense in this case, so we
+ * error out. */
+ if (timeout == -1)
+ {
+ _gpg_err_set_errno (EINVAL);
+ return -1;
+ }
+ if (timeout)
+ Sleep (timeout);
+ code = WAIT_TIMEOUT;
+ }
+ else
+ code = WaitForMultipleObjects (nwait, waitbuf, 0,
+ timeout == -1 ? INFINITE : timeout);
- code = WaitForMultipleObjects (nwait, waitbuf, 0,
- timeout == -1 ? INFINITE : timeout);
if (code < WAIT_OBJECT_0 + nwait)
{
/* This WFMO is a really silly function: It does return either