From 796502e7af380af04463926f5680988a762d6e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Tue, 26 Feb 2008 16:20:04 +0000 Subject: [PATCH] r2087@chromobil: stefan | 2008-02-26 17:01:12 +0100 Fix #1562 and try re-fixing #372: out of range access in fd array - Bug is in original #372 fix [853] - The re-fix for #372 is not tested: the problem is that Solaris doesn't want to poll for maxfds (ulimit) events, as at least one filedescriptor is used for the poll device. So the solution is to just ask for one event less; the number of events actually available is returned by the poll syscall, so it should work. git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2082 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/fdevent_solaris_devpoll.c | 2 +- src/server.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/fdevent_solaris_devpoll.c b/src/fdevent_solaris_devpoll.c index f77daef4..76414a46 100644 --- a/src/fdevent_solaris_devpoll.c +++ b/src/fdevent_solaris_devpoll.c @@ -67,7 +67,7 @@ static int fdevent_solaris_devpoll_poll(fdevents *ev, int timeout_ms) { int ret; dopoll.dp_timeout = timeout_ms; - dopoll.dp_nfds = ev->maxfds; + dopoll.dp_nfds = ev->maxfds - 1; dopoll.dp_fds = ev->devpollfds; ret = ioctl(ev->devpoll_fd, DP_POLL, &dopoll); diff --git a/src/server.c b/src/server.c index 052130ac..585a973b 100644 --- a/src/server.c +++ b/src/server.c @@ -697,9 +697,6 @@ int main (int argc, char **argv) { } } - /* #372: solaris need some fds extra for devpoll */ - if (rlim.rlim_cur > 10) rlim.rlim_cur -= 10; - if (srv->event_handler == FDEVENT_HANDLER_SELECT) { srv->max_fds = rlim.rlim_cur < FD_SETSIZE - 200 ? rlim.rlim_cur : FD_SETSIZE - 200; } else {