mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
rc.apparmor: drop use of xargs as fallback when loading profiles
LP:1377338 <https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1377338> has been fixed for quite awhile and we don't need to call xargs as a fallback when loading policy fails. In addition we really don't want to be doing this because we want to be moving to atomic profile loads where if one profile fails the whole load fails. This is a step in that direction. Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
parent
08f32ac703
commit
0b8ea047e8
1 changed files with 5 additions and 31 deletions
|
@ -161,37 +161,11 @@ __parse_profiles_dir() {
|
|||
# when we pass it a directory, but not when we pass it an individual
|
||||
# profile. So we need to use skip_profile only in the latter case,
|
||||
# as long as the parser is in sync' with skip_profile().
|
||||
"$PARSER" $PARSER_OPTS "$parser_cmd" -- "$profile_dir" || {
|
||||
# FIXME: once the parser properly handles broken profiles
|
||||
# (LP: #1377338), remove the following code and the
|
||||
# skip_profile() function. For now, if the parser returns
|
||||
# an error, just run it again separately on each profile.
|
||||
for profile in "$profile_dir"/*; do
|
||||
skip_profile "$profile"
|
||||
skip=$?
|
||||
if [ "$skip" -eq 2 ]; then
|
||||
# Ignore skip status == 2 (silent skip)
|
||||
continue
|
||||
elif [ "$skip" -ne 0 ] ; then
|
||||
aa_log_skipped_msg "$profile"
|
||||
logger -t "AppArmor(init)" -p daemon.warn \
|
||||
"Skipping profile $profile"
|
||||
continue
|
||||
fi
|
||||
if [ ! -f "$profile" ] ; then
|
||||
continue
|
||||
fi
|
||||
printf "%s\0" "$profile"
|
||||
done | \
|
||||
# Use xargs to parallelize calls to the parser over all CPUs
|
||||
xargs -n1 -0r -P "$(getconf _NPROCESSORS_ONLN)" \
|
||||
"$PARSER" $PARSER_OPTS "$parser_cmd" --
|
||||
if [ $? -ne 0 ]; then
|
||||
status=1
|
||||
aa_log_failure_msg "At least one profile failed to load"
|
||||
fi
|
||||
}
|
||||
|
||||
"$PARSER" $PARSER_OPTS "$parser_cmd" -- "$profile_dir"
|
||||
if [ $? -ne 0 ]; then
|
||||
status=1
|
||||
aa_log_failure_msg "At least one profile failed to load"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue