You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2010/04/09 22:55:57 UTC
svn commit: r932608 - in /apr/apr/branches/1.4.x: CHANGES
include/arch/unix/apr_arch_poll_private.h poll/unix/pollset.c
Author: trawick
Date: Fri Apr 9 20:55:57 2010
New Revision: 932608
URL: http://svn.apache.org/viewvc?rev=932608&view=rev
Log:
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
Modified:
apr/apr/branches/1.4.x/CHANGES
apr/apr/branches/1.4.x/include/arch/unix/apr_arch_poll_private.h
apr/apr/branches/1.4.x/poll/unix/pollset.c
Modified: apr/apr/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?rev=932608&r1=932607&r2=932608&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.4.x/CHANGES [utf-8] Fri Apr 9 20:55:57 2010
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes for APR 1.4.3
+ *) apr_pollset_create*(): Fix memory lifetime problem with the wakeup
+ pipe when the pollset was created with APR_POLLSET_NOCOPY.
+ [Neil Conway <nrc cs.berkeley.edu>]
+
*) Fix detection of some Linux variants when configure is built with
recent GNU tools. [Eric Covener]
Modified: apr/apr/branches/1.4.x/include/arch/unix/apr_arch_poll_private.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/include/arch/unix/apr_arch_poll_private.h?rev=932608&r1=932607&r2=932608&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/include/arch/unix/apr_arch_poll_private.h (original)
+++ apr/apr/branches/1.4.x/include/arch/unix/apr_arch_poll_private.h Fri Apr 9 20:55:57 2010
@@ -115,6 +115,7 @@ struct apr_pollset_t
apr_uint32_t flags;
/* Pipe descriptors used for wakeup */
apr_file_t *wakeup_pipe[2];
+ apr_pollfd_t wakeup_pfd;
apr_pollset_private_t *p;
apr_pollset_provider_t *provider;
};
Modified: apr/apr/branches/1.4.x/poll/unix/pollset.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/poll/unix/pollset.c?rev=932608&r1=932607&r2=932608&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/poll/unix/pollset.c (original)
+++ apr/apr/branches/1.4.x/poll/unix/pollset.c Fri Apr 9 20:55:57 2010
@@ -46,18 +46,18 @@ apr_file_socket_pipe_close(apr_file_t *f
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
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(a
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_p
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.
*/