From 0f8bcb36b08324804c213c591f0001af61c2568f Mon Sep 17 00:00:00 2001 From: Ned Ludd Date: Mon, 21 May 2007 19:27:28 +0000 Subject: - blind chmod 0 before unlinking files to avoid anybody doing sneaky stuff via hardlinks svn path=/main/trunk/; revision=6563 --- pym/portage/dbapi/vartree.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pym') 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 -- cgit v1.2.3-1-g7c22