diff options
author | Brian Pane <brianp@apache.org> | 2002-08-07 00:06:12 +0000 |
---|---|---|
committer | Brian Pane <brianp@apache.org> | 2002-08-07 00:06:12 +0000 |
commit | af9ad622a5467e7e164aaf1a500e5e9c83156cd7 (patch) | |
tree | 83dcc4e9965cde2228e8aecded155a4435650abf /poll/unix/poll.c | |
parent | c73892daa812fed397635440386b6b943684329a (diff) | |
download | apr-af9ad622a5467e7e164aaf1a500e5e9c83156cd7.tar.gz |
Changed apr_poll_socket_remove() and apr_poll() to avoid
putting invalid descriptors on the pollset after removing
from the middle of the array
Reported by: Rob Saccoccio <robs@fastcgi.com>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63801 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll/unix/poll.c')
-rw-r--r-- | poll/unix/poll.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/poll/unix/poll.c b/poll/unix/poll.c index f495c821f..da79e4b95 100644 --- a/poll/unix/poll.c +++ b/poll/unix/poll.c @@ -151,6 +151,10 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, else if (aprset[i].desc_type == APR_POLL_FILE) { pollset[i].fd = aprset[i].desc.f->filedes; } + else if (aprset[i].desc_type == APR_NO_DESC) { + num = i + 1; + break; + } pollset[i].events = get_event(aprset[i].reqevents); } @@ -221,7 +225,7 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num, apr_int32_t *n #endif fd = aprset[i].desc.s->socketdes; } - else { + else if (aprset[i].desc_type == APR_POLL_FILE) { #if !APR_FILES_AS_SOCKETS return APR_EBADF; #else @@ -237,6 +241,10 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num, apr_int32_t *n #endif /* APR_FILES_AS_SOCKETS */ } + else if (aprset[i].desc_type == APR_NO_DESC) { + num = i + 1; + break; + } if (aprset[i].reqevents & APR_POLLIN) { FD_SET(fd, &readset); } |