From 65a5f14f8b76a250f5df42e57512bfc140543622 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 3 Jan 2013 19:39:19 -0800 Subject: EventLoop: enable FD_CLOEXEC on epoll fd --- pym/portage/util/_eventloop/EventLoop.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py index d2d49636d..6c2341bcd 100644 --- a/pym/portage/util/_eventloop/EventLoop.py +++ b/pym/portage/util/_eventloop/EventLoop.py @@ -84,6 +84,17 @@ class EventLoop(object): # IOError: [Errno 38] Function not implemented pass else: + + if fcntl is not None: + try: + fcntl.FD_CLOEXEC + except AttributeError: + pass + else: + fcntl.fcntl(epoll_obj.fileno(), fcntl.F_SETFL, + fcntl.fcntl(epoll_obj.fileno(), + fcntl.F_GETFL) | fcntl.FD_CLOEXEC) + self._poll_obj = _epoll_adapter(epoll_obj) self.IO_ERR = select.EPOLLERR self.IO_HUP = select.EPOLLHUP -- cgit v1.2.3-1-g7c22