From: Michael Tremer Date: Wed, 19 Jul 2017 18:50:48 +0000 (+0200) Subject: copy: Do not empty $dst when source file cannot be read X-Git-Tag: 009~147 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fnetwork.git;a=commitdiff_plain;h=287c2e60ba1237701b40723aeca811b65b5032ec copy: Do not empty $dst when source file cannot be read Signed-off-by: Michael Tremer --- 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"