diff options
author | Jeff Trawick <trawick@apache.org> | 2004-01-30 12:33:46 +0000 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2004-01-30 12:33:46 +0000 |
commit | 09fc00322c6131b841fddb1753046da07d504f32 (patch) | |
tree | a45b5aea7c9a0e285c48a76c19379c2361424d39 /poll | |
parent | 5286ef3613125321c923a527f800339df1d430de (diff) | |
download | apr-09fc00322c6131b841fddb1753046da07d504f32.tar.gz |
Return an error instead of silently failing when apr_poll() is
used with file descriptors >= FD_SETSIZE. (Unix systems with
no native poll())
Submitted by: Jeff Trawick
Reviewed and fixed by: Brad Nicholes
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64887 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r-- | poll/unix/poll.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/poll/unix/poll.c b/poll/unix/poll.c index b90a05815..143c45f5c 100644 --- a/poll/unix/poll.c +++ b/poll/unix/poll.c @@ -248,6 +248,12 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num, apr_int32_t *n else { break; } +#if !defined(WIN32) && !defined(NETWARE) /* socket sets handled with array of handles */ + if (fd >= FD_SETSIZE) { + /* XXX invent new error code so application has a clue */ + return APR_EBADF; + } +#endif if (aprset[i].reqevents & APR_POLLIN) { FD_SET(fd, &readset); } @@ -425,6 +431,12 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, #endif #endif } +#if !defined(WIN32) && !defined(NETWARE) /* socket sets handled with array of handles */ + if (fd >= FD_SETSIZE) { + /* XXX invent new error code so application has a clue */ + return APR_EBADF; + } +#endif if (descriptor->reqevents & APR_POLLIN) { FD_SET(fd, &(pollset->readset)); } |