fix case where myfd == None (regression from revision 2714)
authorZac Medico <zmedico@gentoo.org>
Wed, 15 Feb 2006 18:40:32 +0000 (18:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 15 Feb 2006 18:40:32 +0000 (18:40 -0000)
svn path=/main/trunk/; revision=2715

pym/portage_locks.py

index 7a9b55674a2ac39b630b9c252baac2a451f3f591..f108cba2eccee57fcfbc1e031991a39f32161981 100644 (file)
@@ -147,9 +147,11 @@ def unlockfile(mytuple):
                unhardlink_lockfile(lockfilename)
                return True
        
-       if type(lockfilename) == types.StringType and os.fstat(myfd).st_nlink != 1:
+       # myfd may be None here due to myfd = mypath in lockfile()
+       if type(lockfilename) == types.StringType and not os.path.exists(lockfilename):
                portage_util.writemsg("lockfile does not exist '%s'\n" % lockfilename,1)
-               os.close(myfd)
+               if myfd is not None:
+                       os.close(myfd)
                return False
 
        try: