Don't bother to warn about hardlinks to suid/sgid files before unlink since it can...
authorZac Medico <zmedico@gentoo.org>
Sun, 10 Jun 2007 22:15:33 +0000 (22:15 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 10 Jun 2007 22:15:33 +0000 (22:15 -0000)
svn path=/main/trunk/; revision=6793

pym/portage/dbapi/vartree.py

index 73d2245f9d5e419730087ad42ecaeffe52b00b05..56e4f0097ac1740849251166e66bc738f3e53cc3 100644 (file)
@@ -1226,12 +1226,9 @@ class dblink(object):
                                                writemsg_stdout("--- !md5   %s %s\n" % ("obj", obj))
                                                continue
                                        try:
-                                               if statobj.st_mode & (stat.S_ISUID | stat.S_ISGID):
-                                                       # Always blind chmod 0 before unlinking to avoid race conditions.
-                                                       os.chmod(obj, 0000)
-                                                       if statobj.st_nlink > 1:
-                                                               writemsg("setXid: "+str(statobj.st_nlink-1)+ \
-                                                                       " hardlinks to '%s'\n" % obj)
+                                               # Remove permissions to ensure that any hardlinks to
+                                               # suid/sgid files are rendered harmless.
+                                               os.chmod(obj, 0)
                                                os.unlink(obj)
                                        except (OSError, IOError), e:
                                                pass