Fix lockfile() to close the file descriptor before raising TryAgain.
authorZac Medico <zmedico@gentoo.org>
Sat, 18 Sep 2010 11:12:34 +0000 (04:12 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 18 Sep 2010 11:12:34 +0000 (04:12 -0700)
pym/portage/locks.py

index 00a50b818e79da8a42642dc1fb43301ca1699d2c..1f8f5801300ffab45eb03178fca83f927c32f4b4 100644 (file)
@@ -118,6 +118,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
                if e.errno in (errno.EACCES, errno.EAGAIN):
                        # resource temp unavailable; eg, someone beat us to the lock.
                        if flags & os.O_NONBLOCK:
+                               os.close(myfd)
                                raise TryAgain(mypath)
 
                        global _quiet