summaryrefslogtreecommitdiff
path: root/poll
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2016-06-27 16:01:23 +0000
committerEric Covener <covener@apache.org>2016-06-27 16:01:23 +0000
commit71ee558f66e24910f20b2e0472aed7916aaa7b69 (patch)
tree49de98cb5fc7932d3430b6801c621acf6bf0f09c /poll
parentafb05ba52d4c344e41a43c54161943e36a84f37d (diff)
downloadapr-71ee558f66e24910f20b2e0472aed7916aaa7b69.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1750374 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r--poll/unix/z_asio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/poll/unix/z_asio.c b/poll/unix/z_asio.c
index 6537d4909..6da4ee8e9 100644
--- a/poll/unix/z_asio.c
+++ b/poll/unix/z_asio.c
@@ -247,9 +247,11 @@ static apr_status_t asio_pollset_cleanup(apr_pollset_t *pollset)
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(apr_pollset_t *pollset,
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