2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-04 16:25:10 +00:00

remove_profiles(): Fix returning $retval

Extend the subshell so that the actual (possibly non-zero) value of
$retval gets returned. Before, the changed value was lost at "done"
(= leaving the subshell), and the initial $retval=0 was returned.

(found with shellcheck)
This commit is contained in:
Christian Boltz
2019-03-15 23:12:17 +01:00
parent 6416ccebf6
commit be02f008c3

View File

@@ -340,7 +340,8 @@ remove_profiles() {
# We filter child profiles as removing the parent will remove # We filter child profiles as removing the parent will remove
# the children # the children
sed -e "s/ (\(enforce\|complain\))$//" "$SFS_MOUNTPOINT/profiles" | \ sed -e "s/ (\(enforce\|complain\))$//" "$SFS_MOUNTPOINT/profiles" | \
LC_COLLATE=C sort | grep -v // | while read profile ; do LC_COLLATE=C sort | grep -v // | {
while read profile ; do
echo -n "$profile" > "$SFS_MOUNTPOINT/.remove" echo -n "$profile" > "$SFS_MOUNTPOINT/.remove"
rc=$? rc=$?
if [ ${rc} -ne 0 ] ; then if [ ${rc} -ne 0 ] ; then
@@ -349,6 +350,7 @@ remove_profiles() {
done done
return ${retval} return ${retval}
} }
}
apparmor_stop() { apparmor_stop() {
aa_log_daemon_msg "Unloading AppArmor profiles " aa_log_daemon_msg "Unloading AppArmor profiles "