apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r233379 - /apr/apr/trunk/poll/unix/epoll.c
Date Thu, 18 Aug 2005 21:10:45 GMT
Author: jorton
Date: Thu Aug 18 14:10:41 2005
New Revision: 233379

URL: http://svn.apache.org/viewcvs?rev=233379&view=rev
Log:
* poll/unix/epoll.c (apr_pollset_create): Check for errors from
epoll_create().  Don't leak the epoll fd to spawned children; do
register the cleanup as a child_cleanup too.  Remove a cast to void *.

Modified:
    apr/apr/trunk/poll/unix/epoll.c

Modified: apr/apr/trunk/poll/unix/epoll.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/poll/unix/epoll.c?rev=233379&r1=233378&r2=233379&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/epoll.c (original)
+++ apr/apr/trunk/poll/unix/epoll.c Thu Aug 18 14:10:41 2005
@@ -91,6 +91,13 @@
                                              apr_uint32_t flags)
 {
     apr_status_t rv;
+    int fd;
+
+    fd = epoll_create(size);
+    if (fd < 0) {
+        *pollset = NULL;
+        return errno;
+    }
 
     *pollset = apr_palloc(p, sizeof(**pollset));
 #if APR_HAS_THREADS
@@ -111,10 +118,9 @@
     (*pollset)->nalloc = size;
     (*pollset)->flags = flags;
     (*pollset)->pool = p;
-    (*pollset)->epoll_fd = epoll_create(size);
+    (*pollset)->epoll_fd = fd;
     (*pollset)->pollset = apr_palloc(p, size * sizeof(struct epoll_event));
-    apr_pool_cleanup_register(p, (void *) (*pollset), backend_cleanup,
-                              apr_pool_cleanup_null);
+    apr_pool_cleanup_register(p, *pollset, backend_cleanup, backend_cleanup);
     (*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t));
 
     APR_RING_INIT(&(*pollset)->query_ring, pfd_elem_t, link);



Mime
View raw message