summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorNed Ludd <solar@gentoo.org>2007-05-21 19:27:28 +0000
committerNed Ludd <solar@gentoo.org>2007-05-21 19:27:28 +0000
commit0f8bcb36b08324804c213c591f0001af61c2568f (patch)
tree75324aba556d4b295e756c7b14fe1042398412ff /pym
parentd86fdcb05aa95e7809ab2cde29337487b2f10aac (diff)
downloadportage-0f8bcb36b08324804c213c591f0001af61c2568f.tar.gz
portage-0f8bcb36b08324804c213c591f0001af61c2568f.tar.bz2
portage-0f8bcb36b08324804c213c591f0001af61c2568f.zip
- blind chmod 0 before unlinking files to avoid anybody doing sneaky stuff via hardlinks
svn path=/main/trunk/; revision=6563
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/vartree.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index d438cbee0..3c7e646eb 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1211,6 +1211,10 @@ class dblink(object):
writemsg_stdout("--- !md5 %s %s\n" % ("obj", obj))
continue
try:
+ if statobj.st_nlink > 1:
+ portage.writemsg("There are "+str(st.st_nlink-1)+" hardlinks to " + obj)
+ # Always blind chmod 0 before unlinking to avoid race conditions.
+ os.chmod(obj, 0000)
os.unlink(obj)
except (OSError, IOError), e:
pass