From: Kamalesh Babulal Date: Wed, 23 Feb 2022 06:16:03 +0000 (+0530) Subject: cgroup.py: fix nested loop variable in get_cgroup_mounts() X-Git-Tag: v3.1.0~308^2~2^2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2baa2cbff0dc94acd09abb0af49d9ace1d802701;p=thirdparty%2Flibcgroup.git cgroup.py: fix nested loop variable in get_cgroup_mounts() In get_cgroup_mounts(), both files '/proc/mounts' and '/cgroup.controller' uses 'line' as loop variable to read lines from the file. The issue here is that, they are nested. This patch renames second loop variable 'line' -> 'ctrlf_line'. Reported-by: LGTM Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/cgroup.py b/ftests/cgroup.py index 25d69141..cbc44dd3 100644 --- a/ftests/cgroup.py +++ b/ftests/cgroup.py @@ -861,8 +861,8 @@ class Cgroup(object): with open(os.path.join(mount.mount_point, 'cgroup.controllers')) as ctrlf: - for line in ctrlf.readlines(): - for ctrl in line.split(): + for ctrlf_line in ctrlf.readlines(): + for ctrl in ctrlf_line.split(): mount_copy = copy.deepcopy(mount) mount_copy.controller = ctrl mount_list.append(mount_copy)