2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-01 06:45:38 +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,14 +340,16 @@ 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 // | {
echo -n "$profile" > "$SFS_MOUNTPOINT/.remove" while read profile ; do
rc=$? echo -n "$profile" > "$SFS_MOUNTPOINT/.remove"
if [ ${rc} -ne 0 ] ; then rc=$?
retval=${rc} if [ ${rc} -ne 0 ] ; then
fi retval=${rc}
done fi
return ${retval} done
return ${retval}
}
} }
apparmor_stop() { apparmor_stop() {