diff options
-rw-r--r-- | src/block.sh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/block.sh b/src/block.sh index feab865..ad94bde 100644 --- a/src/block.sh +++ b/src/block.sh @@ -48,12 +48,14 @@ block_mount() rand dir="$(get_vardata_dir 'mount')/block-$(printf '%010d' ${rand_x})" if ! mkdir "${dir}"; then - error 2 "$(get_msg 'block_mkdir_fail')" "${dir}" + error "$(get_msg 'block_mkdir_fail')" "${dir}" + return 1 fi if ! mount "${dev}" "${dir}"; then + error "$(get_msg 'block_mount_fail')" "${dev}" rmdir "${dir}" - error 2 "$(get_msg 'block_mount_fail')" "${dev}" + return 1 fi printf '%s' "${dir}" @@ -78,11 +80,13 @@ block_umount() done if ${timed_out}; then - error 2 "$(get_msg 'block_umount_fail')" "${dir}" + error "$(get_msg 'block_umount_fail')" "${dir}" + return 1 fi if ! rmdir "${dir}"; then - error 2 "$(get_msg 'block_rmdir_fail')" "${dir}" + error "$(get_msg 'block_rmdir_fail')" "${dir}" + return 1 fi return 0 |