summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-08-04 17:36:36 +0000
committerIan Lynagh <igloo@earth.li>2010-08-04 17:36:36 +0000
commitd0fb9a95f40453321b82e23d9b322e79340b48c9 (patch)
tree00f5399b572c7ed90fabe7d65c07396a7833b99b
parent860195b72e08f44539f0569e06d2efaad2bb05a1 (diff)
downloadhaskell-d0fb9a95f40453321b82e23d9b322e79340b48c9.tar.gz
Test for (fd < 0) before trying to FD_SET it
-rw-r--r--rts/posix/Select.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/posix/Select.c b/rts/posix/Select.c
index d36e122079..932fc792fe 100644
--- a/rts/posix/Select.c
+++ b/rts/posix/Select.c
@@ -156,7 +156,7 @@ awaitEvent(rtsBool wait)
case BlockedOnRead:
{
int fd = tso->block_info.fd;
- if (fd >= (int)FD_SETSIZE) {
+ if ((fd >= (int)FD_SETSIZE) || (fd < 0)) {
barf("awaitEvent: descriptor out of range");
}
maxfd = (fd > maxfd) ? fd : maxfd;
@@ -167,7 +167,7 @@ awaitEvent(rtsBool wait)
case BlockedOnWrite:
{
int fd = tso->block_info.fd;
- if (fd >= (int)FD_SETSIZE) {
+ if ((fd >= (int)FD_SETSIZE) || (fd < 0)) {
barf("awaitEvent: descriptor out of range");
}
maxfd = (fd > maxfd) ? fd : maxfd;