From 20091ca87d9e872215e4cf8b51e3bf690a724429 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Mon, 30 Jan 2017 20:48:50 +0100 Subject: [PATCH] Rename global variable "pid" to "log_pid" aa.py has a global variable "pid", but it also has several functions that use "pid" as a local variable name. do_logprof_pass() even uses both - first, it passes the global variable to ReadLog, and then it creates a local variable in the "for pid in ..." loop. This patch renames the global variable to log_pid to get rid of the confusion. Note that the global variable is only handed over to ReadLog, and the only case where its previous content _might_ be used is aa-genprof which does multipe do_logprof_pass() runs. Maybe we could even get rid of this variable in aa.py and make it local to the ReadLog class, but I'm not sure if that would affect aa-genprof in interesting[tm] ways. Acked-by: John Johansen --- utils/apparmor/aa.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index 7a8458def..ab7f6c978 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -105,7 +105,7 @@ original_aa = hasher() extras = hasher() # Inactive profiles from extras ### end our log = [] -pid = dict() +log_pid = dict() # handed over to ReadLog, gets filled in logparser.py. The only case the previous content of this variable _might_(?) be used is aa-genprof (multiple do_logprof_pass() runs) profile_changes = hasher() prelog = hasher() @@ -1857,7 +1857,7 @@ def set_logfile(filename): elif os.path.isdir(logfile): raise AppArmorException(_('%s is a directory. Please specify a file as logfile') % logfile) -def do_logprof_pass(logmark='', passno=0, pid=pid): +def do_logprof_pass(logmark='', passno=0, log_pid=log_pid): # set up variables for this pass # transitions = hasher() global log @@ -1885,7 +1885,7 @@ def do_logprof_pass(logmark='', passno=0, pid=pid): ## if not repo_cfg['repository'].get('enabled', False) or repo_cfg['repository]['enabled'] not in ['yes', 'no']: ## UI_ask_to_enable_repo() - log_reader = apparmor.logparser.ReadLog(pid, logfile, existing_profiles, profile_dir, log) + log_reader = apparmor.logparser.ReadLog(log_pid, logfile, existing_profiles, profile_dir, log) log = log_reader.read_log(logmark) #read_log(logmark)