before opening check if mountpoint is already used by a tomb

a simple check introduced on `tomb open` to list all tombs mounted and
control if any mountpoint is already in use, in case refuse opening.

fix #326
This commit is contained in:
Jaromil 2019-05-22 00:30:48 +02:00
parent 95f2f68654
commit 7b06be5d43

8
tomb
View File

@ -2223,6 +2223,14 @@ mount_tomb() {
_message "Mountpoint not specified, using default: ::1 mount point::" $tombmount
}
# check if the mountpoint is already used
mounted_tombs=(`list_tomb_mounts`)
for t in ${mounted_tombs}; do
usedmount=${t[(ws:;:)2]}
[[ "$usedmount" == "$tombmount" ]] &&
_failure "Mountpoint already in use: ::1 mount point::" $tombmount
done
_success "Opening ::1 tomb file:: on ::2 mount point::" $TOMBNAME $tombmount
lo_mount $TOMBPATH