Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/
Date: Tue, 17 Sep 2019 02:59:30
Message-Id: 1568688764.5c33a020457308af1b9b3937c5a95aa5be2a888f.zmedico@gentoo
1 commit: 5c33a020457308af1b9b3937c5a95aa5be2a888f
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 17 02:42:27 2019 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 17 02:52:44 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5c33a020
7
8 _lockfile_iteration: eliminate recursion and fd leak after chown failure
9
10 Fixes: 02922cb3a7eb ("lockfile: use loop instead of recursion")
11 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
12
13 lib/portage/locks.py | 6 ++----
14 1 file changed, 2 insertions(+), 4 deletions(-)
15
16 diff --git a/lib/portage/locks.py b/lib/portage/locks.py
17 index 609c8b2dc..72ac2fc70 100644
18 --- a/lib/portage/locks.py
19 +++ b/lib/portage/locks.py
20 @@ -194,10 +194,8 @@ def _lockfile_iteration(mypath, wantnewlockfile=False, unlinkfile=False,
21 os.chown(lockfilename, -1, portage_gid)
22 except OSError as e:
23 if e.errno in (errno.ENOENT, errno.ESTALE):
24 - return lockfile(mypath,
25 - wantnewlockfile=wantnewlockfile,
26 - unlinkfile=unlinkfile, waiting_msg=waiting_msg,
27 - flags=flags)
28 + os.close(myfd)
29 + return None
30 else:
31 writemsg("%s: chown('%s', -1, %d)\n" % \
32 (e, lockfilename, portage_gid), noiselevel=-1)