X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fposix%2FSelect.c;h=932fc792fed511384d1a92cc3c51ba33b0585985;hb=d108044bef62f6a0d579c92ced5e8188f72edc2d;hp=46db4054bb6917eba1d45d9abd5ae02d6830ac95;hpb=a2a67cd520b9841114d69a87a423dabcb3b4368e;p=ghc-hetmet.git diff --git a/rts/posix/Select.c b/rts/posix/Select.c index 46db405..932fc79 100644 --- a/rts/posix/Select.c +++ b/rts/posix/Select.c @@ -17,6 +17,10 @@ #include "Select.h" #include "AwaitEvent.h" +# ifdef HAVE_SYS_SELECT_H +# include +# endif + # ifdef HAVE_SYS_TYPES_H # include # endif @@ -152,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; @@ -163,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;