From 661f63b7d2a89d91c29691ba8d01b825600e6789 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sat, 30 Aug 2008 07:32:37 +1000 Subject: - (dtucker) [openbsd-compat/bsd-poll.c] correctly check for number of FDs larger than FD_SETSIZE (OpenSSH only ever uses poll with one fd). Patch from Nicholas Marriott. --- openbsd-compat/bsd-poll.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'openbsd-compat/bsd-poll.c') diff --git a/openbsd-compat/bsd-poll.c b/openbsd-compat/bsd-poll.c index 284db3a1f..f899d7a24 100644 --- a/openbsd-compat/bsd-poll.c +++ b/openbsd-compat/bsd-poll.c @@ -1,4 +1,4 @@ -/* $Id: bsd-poll.c,v 1.3 2008/04/04 05:16:36 djm Exp $ */ +/* $Id: bsd-poll.c,v 1.4 2008/08/29 21:32:38 dtucker Exp $ */ /* * Copyright (c) 2004, 2005, 2007 Darren Tucker (dtucker at zip com au). @@ -46,11 +46,12 @@ poll(struct pollfd *fds, nfds_t nfds, int timeout) struct timeval tv, *tvp = NULL; for (i = 0; i < nfds; i++) { + fd = fds[i].fd; if (fd >= FD_SETSIZE) { errno = EINVAL; return -1; } - maxfd = MAX(maxfd, fds[i].fd); + maxfd = MAX(maxfd, fd); } nmemb = howmany(maxfd + 1 , NFDBITS); -- cgit v1.2.3