apparmor: move dlopen() into mac_apparmor_use() check

This mirrors what we do for mac_selinux_use(), which also loads
libselinux.
This commit is contained in:
Lennart Poettering
2025-11-20 14:19:56 +01:00
parent 8137c6bf2d
commit c3b3eea2e5
3 changed files with 23 additions and 19 deletions
+1 -6
View File
@@ -5751,12 +5751,7 @@ int exec_invoke(
use_smack = mac_smack_use();
#endif
#if HAVE_APPARMOR
if (mac_apparmor_use()) {
r = dlopen_libapparmor();
if (r < 0 && !ERRNO_IS_NEG_NOT_SUPPORTED(r))
log_warning_errno(r, "Failed to load libapparmor, ignoring: %m");
use_apparmor = r >= 0;
}
use_apparmor = mac_apparmor_use();
#endif
}