From 287c2e60ba1237701b40723aeca811b65b5032ec Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 19 Jul 2017 20:50:48 +0200 Subject: [PATCH] copy: Do not empty $dst when source file cannot be read Signed-off-by: Michael Tremer --- src/functions/functions.util | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/functions/functions.util b/src/functions/functions.util index 5935dcc2..664e9091 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -760,6 +760,12 @@ copy() { local src=${1} local dst=${2} + # Check if we can read from the source + if [ ! -r "${src}" ]; then + log ERROR "Cannot read ${src}" + return ${EXIT_ERROR} + fi + # Check if ${dst} is a directory if [ -d "${dst}" ]; then log ERROR "${dst} is a directory" -- 2.39.2