]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
cgroup.py: fix nested loop variable in get_cgroup_mounts()
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 23 Feb 2022 06:16:03 +0000 (11:46 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 24 Feb 2022 15:08:53 +0000 (08:08 -0700)
In get_cgroup_mounts(), both files '/proc/mounts' and
'<mountpoint>/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 <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/cgroup.py

index 25d691418721c2f16dbf64694c76d1f2d4783fe5..cbc44dd3768f7b304f5b6157655b26597fb83d89 100644 (file)
@@ -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)