mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-28 12:58:07 +00:00
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 <john.johansen@canonical.com>
This commit is contained in:
parent
2eee4d6acb
commit
20091ca87d
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user