summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-01-03 20:25:15 -0800
committerZac Medico <zmedico@gentoo.org>2013-01-03 20:25:15 -0800
commit628048d69acf0fda3adcf89793b1936ab70cad0e (patch)
tree27d20c3b89edfa95229ecd465c6da094412c7257
parent67f618433366316dca8e8c5cdc08e106e268c81a (diff)
downloadportage-628048d69acf0fda3adcf89793b1936ab70cad0e.tar.gz
portage-628048d69acf0fda3adcf89793b1936ab70cad0e.tar.bz2
portage-628048d69acf0fda3adcf89793b1936ab70cad0e.zip
Enable FD_CLOEXEC for lock fd.
-rw-r--r--pym/portage/locks.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/pym/portage/locks.py b/pym/portage/locks.py
index 59fbc6ec0..ed9238d58 100644
--- a/pym/portage/locks.py
+++ b/pym/portage/locks.py
@@ -1,5 +1,5 @@
# portage: Lock management code
-# Copyright 2004-2012 Gentoo Foundation
+# Copyright 2004-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ["lockdir", "unlockdir", "lockfile", "unlockfile", \
@@ -207,6 +207,15 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
waiting_msg=waiting_msg, flags=flags)
if myfd != HARDLINK_FD:
+
+ try:
+ fcntl.FD_CLOEXEC
+ except AttributeError:
+ pass
+ else:
+ fcntl.fcntl(myfd, fcntl.F_SETFL,
+ fcntl.fcntl(myfd, fcntl.F_GETFL) | fcntl.FD_CLOEXEC)
+
_open_fds.add(myfd)
writemsg(str((lockfilename,myfd,unlinkfile))+"\n",1)