From: Tom Hromatka Date: Fri, 18 Mar 2022 14:00:12 +0000 (-0600) Subject: cgroup.py: Fix potential undeclared variable X-Git-Tag: v3.1.0~308^2~2^2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0c06b2d8eca9ecc45735f868a6054776eedf293;p=thirdparty%2Flibcgroup.git cgroup.py: Fix potential undeclared variable Due to the try/except and if/else paths in snapshot(), the variable res may not be declared before reaching the return statement. In the case where it's undeclared, re-raise the exception. Signed-off-by: Tom Hromatka --- diff --git a/ftests/cgroup.py b/ftests/cgroup.py index c252d8b5..75d15b8b 100644 --- a/ftests/cgroup.py +++ b/ftests/cgroup.py @@ -556,6 +556,8 @@ class Cgroup(object): if re.ret == 0 and \ 'neither blacklisted nor whitelisted' in re.stderr: res = re.stdout + else: + raise(re) # convert the cgsnapshot stdout to a dict of cgroup objects return Cgroup.snapshot_to_dict(res)