from trunk: fix off by one errors in devpoll; from Ian Bell

svn:r922
This commit is contained in:
Niels Provos 2008-07-25 01:19:53 +00:00
parent 975b102180
commit 534f6657f8
2 changed files with 4 additions and 3 deletions

View File

@ -13,6 +13,7 @@ Changes in 1.4.6-stable:
o Fix a memory leak when using signals for some event bases; reported by Alexander Drozdov.
o Add libevent.vcproj file to distribution to help with Windows build.
o Fix a problem with epoll() and reinit; problem report by Alexander Drozdov.
o Fix off-by-one errors in devpoll; from Ian Bell
Changes in 1.4.5-stable:
o Fix connection keep-alive behavior for HTTP/1.0

View File

@ -139,7 +139,7 @@ devpoll_init(struct event_base *base)
if (getrlimit(RLIMIT_NOFILE, &rl) == 0 &&
rl.rlim_cur != RLIM_INFINITY)
nfiles = rl.rlim_cur - 1;
nfiles = rl.rlim_cur;
/* Initialize the kernel queue */
if ((dpfd = open("/dev/poll", O_RDWR)) == -1) {
@ -187,12 +187,12 @@ devpoll_recalc(struct event_base *base, void *arg, int max)
{
struct devpollop *devpollop = arg;
if (max > devpollop->nfds) {
if (max >= devpollop->nfds) {
struct evdevpoll *fds;
int nfds;
nfds = devpollop->nfds;
while (nfds < max)
while (nfds <= max)
nfds <<= 1;
fds = realloc(devpollop->fds, nfds * sizeof(struct evdevpoll));