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

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-06-03 20:31:33 +0400
committerChristopher Faylor <me@cgf.cx>2012-06-03 20:31:33 +0400
commit7c15768aa5f2858aca06f0001f7b5b271c34b163 (patch)
tree12a9fb1e195a2b8ba2e67a8f60f02c53f752611b
parent00a312432556e607a16d880932c544f314f7e09e (diff)
* 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.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/select.cc16
2 files changed, 17 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1701dd74f..5789ae1e1 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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.
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index ad78cc228..b9f79e8b5 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -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);