Fix logic bug.

This commit is contained in:
Rudd-O 2018-10-24 08:00:20 +00:00 committed by GitHub
parent 1ecb680b44
commit 3b93db99f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
# Location of files which contains list of protected files # Location of files which contains list of protected files
PROTECTED_FILE_LIST='/etc/qubes/protected-files.d /rw/qubes/protected-files.d' PROTECTED_FILE_LIST='/etc/qubes/protected-files.d'
PER_VM_PROTECTED_FILE_LIST='/rw/qubes/protected-files.d'
qsvc() { qsvc() {
# Returns whether a service is enabled. # Returns whether a service is enabled.
@ -100,7 +101,16 @@ reload_random_seed() {
} }
is_protected_file() { is_protected_file() {
grep -Fxrq --exclude='*.rpmsave' --exclude='*~' --exclude='*.rpmnew' --exclude='*.rpmold' -- "${1}" $PROTECTED_FILE_LIST 2>/dev/null local ret=0
local pfilelist
for pfilelist in "$PROTECTED_FILE_LIST" "$PER_VM_PROTECTED_FILE_LIST" ; do
if test -d "$pfilelist" ; then
# If this succeeds, we return immediately to the caller.
# If not, we let the loop continue.
grep -Fxrq --exclude='*.rpmsave' --exclude='*~' --exclude='*.rpmnew' --exclude='*.rpmold' -- "${1}" "$pfilelist" 2>/dev/null && return 0 || ret="$?"
fi
done
return "$ret"
} }
umount_retry() { umount_retry() {