From 47b951ba3fbe191dcfb5422ea5da4fc0d2d2d019 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Wed, 10 Nov 2021 13:50:10 +0000 Subject: Merge r1894914 from trunk: poll: Fix possible blocking when draining the wakeup pipe. apr_poll_drain_wakeup_pipe() can block if exactly 512 bytes (or multiple thereof) are available on the drained pipe, fix this by setting read end of the pipe nonblocking (the write end is still blocking). Submitted by: Mihaly Szjatinya Reviewed by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1894916 13f79535-47bb-0310-9956-ffa450edef68 --- poll/unix/wakeup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/poll/unix/wakeup.c b/poll/unix/wakeup.c index acf8afc97..6c3dcd6fb 100644 --- a/poll/unix/wakeup.c +++ b/poll/unix/wakeup.c @@ -80,8 +80,9 @@ apr_status_t apr_poll_create_wakeup_pipe(apr_pool_t *pool, apr_pollfd_t *pfd, { apr_status_t rv; - if ((rv = apr_file_pipe_create(&wakeup_pipe[0], &wakeup_pipe[1], - pool)) != APR_SUCCESS) + if ((rv = apr_file_pipe_create_ex(&wakeup_pipe[0], &wakeup_pipe[1], + APR_WRITE_BLOCK, + pool)) != APR_SUCCESS) return rv; pfd->p = pool; -- cgit v1.2.1