summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Mesbah <mesbah.amin@gmail.com>2017-02-13 01:27:40 (GMT)
committer Amin Mesbah <mesbah.amin@gmail.com>2017-02-13 01:44:55 (GMT)
commit70334f58fb254f430d744f94e13db0e3bc656268 (patch)
tree0bf324908850e3accf19486f74958905815bd968
parentf4f8c4e024218d47cfee1a8467c53d7ce54b4acc (diff)
Skip writable check when mounting with "ro" option.refs/pull/248/head
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.
-rwxr-xr-xtomb3
1 files changed, 2 insertions, 1 deletions
diff --git a/tomb b/tomb
index cd286b1..71352c6 100755
--- a/tomb
+++ b/tomb
@@ -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
}