handle failure in load_key when key is not retrieved from stdin

This commit is contained in:
Jaromil 2015-01-27 17:31:09 +01:00
parent ca012e8744
commit 90e46854bc

6
tomb
View File

@ -879,6 +879,12 @@ _load_key() {
_verbose "load_key: ::1 key::" $TOMBKEYFILE _verbose "load_key: ::1 key::" $TOMBKEYFILE
[[ "$TOMBKEY" = "" ]] && {
# something went wrong, there is no key to load
# this occurs especially when piping from stdin and aborted
_failure "Key not found, specify one using -k."
}
is_valid_key $TOMBKEY || { is_valid_key $TOMBKEY || {
_warning "The key seems invalid or its format is not known by this version of Tomb." _warning "The key seems invalid or its format is not known by this version of Tomb."
_tomb_key_recover $TOMBKEY _tomb_key_recover $TOMBKEY