projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
860195b
)
Test for (fd < 0) before trying to FD_SET it
author
Ian Lynagh
<igloo@earth.li>
Wed, 4 Aug 2010 17:36:36 +0000
(17:36 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Wed, 4 Aug 2010 17:36:36 +0000
(17:36 +0000)
rts/posix/Select.c
patch
|
blob
|
history
diff --git
a/rts/posix/Select.c
b/rts/posix/Select.c
index
d36e122
..
932fc79
100644
(file)
--- 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;
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;
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;
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;
barf("awaitEvent: descriptor out of range");
}
maxfd = (fd > maxfd) ? fd : maxfd;