From b4310a9366875c08957744e10eca66802af15ff8 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Tue, 28 Nov 2017 21:55:17 +0000 Subject: [PATCH] Merge branch 'cboltz-double-read-inactive' into 'master' Let read_inactive_profiles() do nothing when calling it the second time See merge request apparmor/apparmor!17 (cherry picked from commit 794d1c4a075c6dd017d6566689039c27eb5e0f34) b307e535 Let read_inactive_profiles() do nothing when calling it the second time --- utils/apparmor/aa.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index 7a9fb47e6..27ad754a0 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -2226,6 +2226,13 @@ def read_profiles(): read_profile(profile_dir + '/' + file, True) def read_inactive_profiles(): + if hasattr(read_inactive_profiles, 'already_read'): + # each autodep() run calls read_inactive_profiles, but that's a) superfluous and b) triggers a conflict because the inactive profiles are already loaded + # therefore don't do anything if the inactive profiles were already loaded + return + + read_inactive_profiles.already_read = True + if not os.path.exists(extra_profile_dir): return None try: