From: simonmar Date: Wed, 30 Nov 2005 15:58:47 +0000 (+0000) Subject: [project @ 2005-11-30 15:58:47 by simonmar] X-Git-Tag: final_switch_to_darcs,_this_repo_is_now_live~108 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=b27a416bb2221fd4c6730de62367371ee30c36b1 [project @ 2005-11-30 15:58:47 by simonmar] check for overrun of the fd_set, some OSs give you more descriptors than FD_SETSIZE --- diff --git a/ghc/rts/posix/Select.c b/ghc/rts/posix/Select.c index 8dfafe2..0f7a6df 100644 --- a/ghc/rts/posix/Select.c +++ b/ghc/rts/posix/Select.c @@ -144,6 +144,9 @@ awaitEvent(rtsBool wait) case BlockedOnRead: { int fd = tso->block_info.fd; + if (fd >= FD_SETSIZE) { + barf("awaitEvent: descriptor out of range"); + } maxfd = (fd > maxfd) ? fd : maxfd; FD_SET(fd, &rfd); continue; @@ -152,6 +155,9 @@ awaitEvent(rtsBool wait) case BlockedOnWrite: { int fd = tso->block_info.fd; + if (fd >= FD_SETSIZE) { + barf("awaitEvent: descriptor out of range"); + } maxfd = (fd > maxfd) ? fd : maxfd; FD_SET(fd, &wfd); continue;