summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-09-14 06:33:48 +0000
committerZac Medico <zmedico@gentoo.org>2006-09-14 06:33:48 +0000
commitdcd003237afb6b0449ecffe3a7eb3d2acc61b28a (patch)
treedf5694d30a5e86b18cf2f74a7f238036f907e238 /pym/portage_locks.py
parentnote that you need to use an absolute path for ROOT #147427 by Brad Plant (diff)
downloadportage-multirepo-dcd003237afb6b0449ecffe3a7eb3d2acc61b28a.tar.gz
portage-multirepo-dcd003237afb6b0449ecffe3a7eb3d2acc61b28a.tar.bz2
portage-multirepo-dcd003237afb6b0449ecffe3a7eb3d2acc61b28a.zip
In unhardlink_lockfile(), make sure not to touch lockfilename unless we really have a lock. See bug #147453.
svn path=/main/trunk/; revision=4446
Diffstat (limited to 'pym/portage_locks.py')
-rw-r--r--pym/portage_locks.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pym/portage_locks.py b/pym/portage_locks.py
index 4a61f631..8e6a9803 100644
--- a/pym/portage_locks.py
+++ b/pym/portage_locks.py
@@ -271,13 +271,16 @@ def hardlink_lockfile(lockfilename, max_wait=14400):
def unhardlink_lockfile(lockfilename):
myhardlock = hardlock_name(lockfilename)
- try:
- if os.path.exists(myhardlock):
- os.unlink(myhardlock)
- if os.path.exists(lockfilename):
+ if hardlink_is_mine(myhardlock, lockfilename):
+ # Make sure not to touch lockfilename unless we really have a lock.
+ try:
os.unlink(lockfilename)
+ except OSError:
+ pass
+ try:
+ os.unlink(myhardlock)
except OSError:
- portage_util.writemsg("Something strange happened to our hardlink locks.\n")
+ pass
def hardlock_cleanup(path, remove_all_locks=False):
mypid = str(os.getpid())