mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
aa-remove-unknown: fix readability check
This check is intended for ensuring that the profiles file can actually be opened. The *actual* check is performed by the shell, not the read utility, which won't even be executed if the input redirection (and hence the test) fails. If the test succeeds, though, using `read` here might actually jeopardize the test result if there are no profiles loaded and the file is empty. This commit fixes that case by simply using `true` instead of `read`.
This commit is contained in:
parent
420945139c
commit
b4aa00de51
1 changed files with 1 additions and 1 deletions
|
@ -63,7 +63,7 @@ fi
|
||||||
# We have to do this check because error checking awk's getline() below is
|
# We have to do this check because error checking awk's getline() below is
|
||||||
# tricky and, as is, results in an infinite loop when apparmorfs returns an
|
# tricky and, as is, results in an infinite loop when apparmorfs returns an
|
||||||
# error from open().
|
# error from open().
|
||||||
if ! IFS= read -r _ < "$PROFILES" ; then
|
if ! true < "$PROFILES" ; then
|
||||||
echo "ERROR: Unable to read apparmorfs profiles file" 1>&2
|
echo "ERROR: Unable to read apparmorfs profiles file" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
elif [ ! -w "$REMOVE" ] ; then
|
elif [ ! -w "$REMOVE" ] ; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue