Simplify portage_locks.hardlink_is_mine() so that it only checks the number of links...
authorZac Medico <zmedico@gentoo.org>
Thu, 14 Sep 2006 07:44:54 +0000 (07:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 14 Sep 2006 07:44:54 +0000 (07:44 -0000)
svn path=/main/trunk/; revision=4448

pym/portage_locks.py

index 98ccab8ae29f518abf56a8a558aada57b43f5cb7..77169906c21859bf121590b67e829652a133cf73 100644 (file)
@@ -193,19 +193,9 @@ def hardlink_active(lock):
 
 def hardlink_is_mine(link,lock):
        try:
-               myhls = os.stat(link)
-               mylfs = os.stat(lock)
+               return os.stat(link).st_nlink == 2
        except OSError:
-               myhls = None
-               mylfs = None
-
-       if myhls:
-               if myhls[stat.ST_NLINK] == 2:
-                       return True
-               if mylfs:
-                       if mylfs[stat.ST_INO] == myhls[stat.ST_INO]:
-                               return True
-       return False
+               return False
 
 def hardlink_lockfile(lockfilename, max_wait=14400):
        """Does the NFS, hardlink shuffle to ensure locking on the disk.