diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-06-21 02:42:00 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-06-21 02:42:00 +0000 |
commit | 8530a4e267a7bf61e669888bca3f07b576b81270 (patch) | |
tree | d695a13d7ba56ce0ffb0c2bbe3201e061c196c5a /pym | |
parent | 59353b3dee6cde749244f6596a36032e50639c88 (diff) | |
download | portage-8530a4e267a7bf61e669888bca3f07b576b81270.tar.gz portage-8530a4e267a7bf61e669888bca3f07b576b81270.tar.bz2 portage-8530a4e267a7bf61e669888bca3f07b576b81270.zip |
To prevent infinite recursion when a lock file has more than 1 hardlink, test for exactly 0 hardlinks before recursing. Also use wantnewlockfile=1 on /var/lib/portage/config (see bug #137269). This patch is from svn r3540 and r3543.
svn path=/main/branches/2.1/; revision=3568
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage.py | 3 | ||||
-rw-r--r-- | pym/portage_locks.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/pym/portage.py b/pym/portage.py index 61fb472c8..042656dd6 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6366,7 +6366,8 @@ class dblink: os.chown(my_private_path, os.getuid(), portage_gid) os.chmod(my_private_path, 02770) - mylock = portage_locks.lockfile(os.path.join(destroot, CONFIG_MEMORY_FILE)) + mylock = portage_locks.lockfile( + os.path.join(destroot, CONFIG_MEMORY_FILE), wantnewlockfile=1) writedict(cfgfiledict, os.path.join(destroot, CONFIG_MEMORY_FILE)) portage_locks.unlockfile(mylock) diff --git a/pym/portage_locks.py b/pym/portage_locks.py index 30946c437..b474cc491 100644 --- a/pym/portage_locks.py +++ b/pym/portage_locks.py @@ -121,7 +121,7 @@ def lockfile(mypath,wantnewlockfile=0,unlinkfile=0): if type(lockfilename) == types.StringType and \ - myfd != HARDLINK_FD and os.fstat(myfd).st_nlink != 1: + myfd != HARDLINK_FD and os.fstat(myfd).st_nlink == 0: # The file was deleted on us... Keep trying to make one... os.close(myfd) portage_util.writemsg("lockfile recurse\n",1) |