summaryrefslogtreecommitdiff
path: root/poll
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2010-04-09 20:49:02 +0000
committerJeff Trawick <trawick@apache.org>2010-04-09 20:49:02 +0000
commitb950c603e58a129f11fb412069c81b9515115cec (patch)
treed66e066ec127c6bde6c1b232bb0a981df99e95d6 /poll
parent7fe830ebda3dccc72764e7190cb84d491cf42925 (diff)
downloadapr-b950c603e58a129f11fb412069c81b9515115cec.tar.gz
backport from trunk r932585:
fix misuse of autodata in initialization of the wakeup pipe when the pollset was created with APR_POLLSET_NOCOPY Submitted by: Neil Conway <nrc cs.berkeley.edu> Reviewed by: trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.5.x@932599 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r--poll/unix/pollset.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/poll/unix/pollset.c b/poll/unix/pollset.c
index 5ad70c994..d796ce6b3 100644
--- a/poll/unix/pollset.c
+++ b/poll/unix/pollset.c
@@ -46,18 +46,18 @@ apr_file_socket_pipe_close(apr_file_t *file);
static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset)
{
apr_status_t rv;
- apr_pollfd_t fd;
if ((rv = apr_file_socket_pipe_create(&pollset->wakeup_pipe[0],
&pollset->wakeup_pipe[1],
pollset->pool)) != APR_SUCCESS)
return rv;
- fd.reqevents = APR_POLLIN;
- fd.desc_type = APR_POLL_FILE;
- fd.desc.f = pollset->wakeup_pipe[0];
- /* Add the pipe to the pollset
- */
- return apr_pollset_add(pollset, &fd);
+
+ pollset->wakeup_pfd.p = pollset->pool;
+ pollset->wakeup_pfd.reqevents = APR_POLLIN;
+ pollset->wakeup_pfd.desc_type = APR_POLL_FILE;
+ pollset->wakeup_pfd.desc.f = pollset->wakeup_pipe[0];
+
+ return apr_pollset_add(pollset, &pollset->wakeup_pfd);
}
#else /* !WIN32 */
@@ -79,15 +79,16 @@ static apr_status_t apr_file_socket_pipe_close(apr_file_t *file)
static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset)
{
apr_status_t rv;
- apr_pollfd_t fd;
if ((rv = apr_file_pipe_create(&pollset->wakeup_pipe[0],
&pollset->wakeup_pipe[1],
pollset->pool)) != APR_SUCCESS)
return rv;
- fd.reqevents = APR_POLLIN;
- fd.desc_type = APR_POLL_FILE;
- fd.desc.f = pollset->wakeup_pipe[0];
+
+ pollset->wakeup_pfd.p = pollset->pool;
+ pollset->wakeup_pfd.reqevents = APR_POLLIN;
+ pollset->wakeup_pfd.desc_type = APR_POLL_FILE;
+ pollset->wakeup_pfd.desc.f = pollset->wakeup_pipe[0];
{
int flags;
@@ -110,9 +111,7 @@ static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset)
return errno;
}
- /* Add the pipe to the pollset
- */
- return apr_pollset_add(pollset, &fd);
+ return apr_pollset_add(pollset, &pollset->wakeup_pfd);
}
#endif /* !APR_FILES_AS_SOCKETS */
@@ -125,7 +124,7 @@ void apr_pollset_drain_wakeup_pipe(apr_pollset_t *pollset)
while (apr_file_read(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) {
/* Although we write just one byte to the other end of the pipe
- * during wakeup, multiple treads could call the wakeup.
+ * during wakeup, multiple threads could call the wakeup.
* So simply drain out from the input side of the pipe all
* the data.
*/