Fix a bug: when file is not exist, return error

This commit is contained in:
Samson-W 2019-10-15 04:16:44 +08:00
parent 96e2d5bd40
commit ed894c0b43
1 changed files with 8 additions and 5 deletions

View File

@ -152,12 +152,15 @@ has_file_correct_ownership() {
has_file_correct_permissions() {
local FILE=$1
local PERMISSIONS=$2
if [ $($SUDO_CMD stat -L -c "%a" $1) = "$PERMISSIONS" ]; then
FNRET=0
else
if [ -e $FILE ]; then
if [ $($SUDO_CMD stat -L -c "%a" $1) = "$PERMISSIONS" ]; then
FNRET=0
else
FNRET=1
fi
else
FNRET=1
fi
fi
}
does_pattern_exist_in_file() {