copy_data_to_pki(): Immediate exit-with-error or 'shift' on success

This captures any copy errors and/or clears the excess second parameter.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-03-29 23:38:37 +01:00
parent 4ff6b773d2
commit ef59ea7dd9
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -700,7 +700,8 @@ install_data_to_pki () {
# Copy the source to the PKI
copy_data_to_pki () {
cp ${2:+-R} "$1" "$EASYRSA_PKI"
cp ${2:+-R} "$1" "$EASYRSA_PKI" || return
shift # Clear recurse
} # => copy_data_to_pki ()
# Disable terminal echo, if possible, otherwise warn