Commit d0fb9a95 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Test for (fd < 0) before trying to FD_SET it

parent 860195b7
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment