summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-01-03 19:39:19 -0800
committerZac Medico <zmedico@gentoo.org>2013-01-03 19:39:19 -0800
commit65a5f14f8b76a250f5df42e57512bfc140543622 (patch)
treeac6747dfb7823649b6d419f0d2ce416e0a7d0b0b
parentb1637bc9d66bbee3a036dae968ef05aa4d4ac15d (diff)
downloadportage-65a5f14f8b76a250f5df42e57512bfc140543622.tar.gz
portage-65a5f14f8b76a250f5df42e57512bfc140543622.tar.bz2
portage-65a5f14f8b76a250f5df42e57512bfc140543622.zip
EventLoop: enable FD_CLOEXEC on epoll fd
-rw-r--r--pym/portage/util/_eventloop/EventLoop.py11
1 files changed, 11 insertions, 0 deletions
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