You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by co...@apache.org on 2016/06/27 16:01:23 UTC
svn commit: r1750374 - /apr/apr/trunk/poll/unix/z_asio.c
Author: covener
Date: Mon Jun 27 16:01:23 2016
New Revision: 1750374
URL: http://svn.apache.org/viewvc?rev=1750374&view=rev
Log:
Fix a case where the cleanup for a pollset w/o the thread-safe flag
would try to zap a random/garbage message queue identifier. In httpd,
this could happen with e.g. mod_cgi's short-lived, non-threadsafe
pollset.
Modified:
apr/apr/trunk/poll/unix/z_asio.c
Modified: apr/apr/trunk/poll/unix/z_asio.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/poll/unix/z_asio.c?rev=1750374&r1=1750373&r2=1750374&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/z_asio.c (original)
+++ apr/apr/trunk/poll/unix/z_asio.c Mon Jun 27 16:01:23 2016
@@ -247,9 +247,11 @@ static apr_status_t asio_pollset_cleanup
int rv;
DBG(4, "entered\n");
- rv = msgctl(pollset->p->msg_q, IPC_RMID, NULL);
+ if (pollset->flags & APR_POLLSET_THREADSAFE) {
+ rv = msgctl(pollset->p->msg_q, IPC_RMID, NULL);
+ DBG1(4, "asio_pollset_cleanup: msgctl(IPC_RMID) returned %d\n", rv);
+ }
- DBG1(4, "exiting, msgctl(IPC_RMID) returned %d\n", rv);
return rv;
}
@@ -264,7 +266,7 @@ static apr_status_t asio_pollset_create(
DBG1(2, "entered, flags: %x\n", flags);
- priv = pollset->p = apr_palloc(p, sizeof(*priv));
+ priv = pollset->p = apr_pcalloc(p, sizeof(*priv));
if (flags & APR_POLLSET_THREADSAFE) {
#if APR_HAS_THREADS