summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/EbuildMetadataPhase.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-01-03 20:16:17 -0800
committerZac Medico <zmedico@gentoo.org>2013-01-03 20:16:17 -0800
commit67f618433366316dca8e8c5cdc08e106e268c81a (patch)
treeec451083ab5ef091b0b4d64288782cb48e2535ed /pym/_emerge/EbuildMetadataPhase.py
parent65a5f14f8b76a250f5df42e57512bfc140543622 (diff)
downloadportage-67f618433366316dca8e8c5cdc08e106e268c81a.tar.gz
portage-67f618433366316dca8e8c5cdc08e106e268c81a.tar.bz2
portage-67f618433366316dca8e8c5cdc08e106e268c81a.zip
Enable FD_CLOEXEC for non-blocking pipes.
Diffstat (limited to 'pym/_emerge/EbuildMetadataPhase.py')
-rw-r--r--pym/_emerge/EbuildMetadataPhase.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index 89734e045..4806f5c2d 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.SubProcess import SubProcess
@@ -91,8 +91,17 @@ class EbuildMetadataPhase(SubProcess):
files = self._files
master_fd, slave_fd = os.pipe()
+
+ fcntl_flags = os.O_NONBLOCK
+ try:
+ fcntl.FD_CLOEXEC
+ except AttributeError:
+ pass
+ else:
+ fcntl_flags |= fcntl.FD_CLOEXEC
+
fcntl.fcntl(master_fd, fcntl.F_SETFL,
- fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK)
+ fcntl.fcntl(master_fd, fcntl.F_GETFL) | fcntl_flags)
fd_pipes[self._metadata_fd] = slave_fd