From: Zac Medico Date: Fri, 4 Jan 2013 03:39:19 +0000 (-0800) Subject: EventLoop: enable FD_CLOEXEC on epoll fd X-Git-Tag: v2.2.0_alpha150~47 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=65a5f14f8b76a250f5df42e57512bfc140543622;p=portage.git EventLoop: enable FD_CLOEXEC on epoll fd --- 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