Skip writable check when mounting with "ro" option.

When opening a tomb file with "ro" passed through the -o option, the
writability check in is-valid-tomb() is skipped. This allows tomb files
to be opened without write permission.

test-open-read-only() now succeeds.
This commit is contained in:
Amin Mesbah 2017-02-12 17:27:40 -08:00
parent f4f8c4e024
commit 70334f58fb

3
tomb
View File

@ -507,7 +507,8 @@ is_valid_tomb() {
_fail=0
# Tomb file must be a readable, writable, non-empty regular file.
[[ ! -w "$1" ]] && {
# If passed the "ro" mount option, the writable check is skipped.
[[ ! -w "$1" ]] && [[ $(option_value -o) != *"ro"* ]] && {
_warning "Tomb file is not writable: ::1 tomb file::" $1
_fail=1
}