summaryrefslogtreecommitdiff
path: root/poll/unix/kqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'poll/unix/kqueue.c')
-rw-r--r--poll/unix/kqueue.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/poll/unix/kqueue.c b/poll/unix/kqueue.c
index 406eba6e9..34ec1dd42 100644
--- a/poll/unix/kqueue.c
+++ b/poll/unix/kqueue.c
@@ -15,6 +15,7 @@
*/
#include "apr_arch_poll_private.h"
+#include "apr_arch_inherit.h"
#ifdef POLLSET_USES_KQUEUE
@@ -156,6 +157,17 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
return apr_get_netos_error();
}
+ {
+ int flags;
+
+ if ((flags = fcntl((*pollset)->kqueue_fd, F_GETFD)) == -1)
+ return errno;
+
+ flags |= FD_CLOEXEC;
+ if (fcntl((*pollset)->kqueue_fd, F_SETFD, flags) == -1)
+ return errno;
+ }
+
(*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t));
APR_RING_INIT(&(*pollset)->query_ring, pfd_elem_t, link);
@@ -389,7 +401,18 @@ APR_DECLARE(apr_status_t) apr_pollcb_create(apr_pollcb_t **pollcb,
*pollcb = NULL;
return apr_get_netos_error();
}
-
+
+ {
+ int flags;
+
+ if ((flags = fcntl(fd, F_GETFD)) == -1)
+ return errno;
+
+ flags |= FD_CLOEXEC;
+ if (fcntl(fd, F_SETFD, flags) == -1)
+ return errno;
+ }
+
*pollcb = apr_palloc(p, sizeof(**pollcb));
(*pollcb)->nalloc = size;
(*pollcb)->pool = p;