* select.cc (cygwin_select): Make sure that we only return -1 as an error

return.
(select_stuff::wait): Semi-revert to previous method for filling out w4.
This commit is contained in:
Christopher Faylor 2012-06-03 16:31:33 +00:00
parent 00a3124325
commit 7c15768aa5
2 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2012-06-03 Christopher Faylor <me.cygwin2012@cgf.cx>
* select.cc (cygwin_select): Make sure that we only return -1 as an
error return.
(select_stuff::wait): Semi-revert to previous method for filling out
w4.
2012-06-02 Christopher Faylor <me.cygwin2012@cgf.cx>
* select.cc (cygwin_select): Add some comments.

View File

@ -198,6 +198,8 @@ cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
}
}
if (res < -1)
res = -1;
syscall_printf ("%R = select(%d, %p, %p, %p, %p)", res, maxfds, readfds,
writefds, exceptfds, to);
return res;
@ -315,7 +317,7 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
if ((w4[m] = pthread::get_cancel_event ()) != NULL)
m++;
int startfds = m;
DWORD startfds = m;
/* Loop through the select chain, starting up anything appropriate and
counting the number of active fds. */
while ((s = s->next))
@ -331,11 +333,13 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
return select_error;
}
if (s->h != NULL)
for (DWORD i = startfds; i <= m; i++)
if (i == m)
w4[m = i] = s->h;
else if (w4[i] == s->h)
break;
{
for (DWORD i = startfds; i < m; i++)
if (w4[i] == s->h)
goto next_while;
w4[m++] = s->h;
}
next_while:;
}
debug_printf ("m %d, ms %u", m, ms);