From b27a416bb2221fd4c6730de62367371ee30c36b1 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 30 Nov 2005 15:58:47 +0000 Subject: [PATCH] [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 --- ghc/rts/posix/Select.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 1.7.10.4