diff options
author | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2004-01-30 12:33:46 +0000 |
---|---|---|
committer | trawick <trawick@13f79535-47bb-0310-9956-ffa450edef68> | 2004-01-30 12:33:46 +0000 |
commit | f8563884c0c8adf8eeac9d02bd8aae6a66b240a8 (patch) | |
tree | a45b5aea7c9a0e285c48a76c19379c2361424d39 /poll | |
parent | 3ef7db4670bff34773b7628733f9ae3c9374ac06 (diff) | |
download | libapr-f8563884c0c8adf8eeac9d02bd8aae6a66b240a8.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: http://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)); } |