]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.util
copy: Do not empty $dst when source file cannot be read
[people/ms/network.git] / src / functions / functions.util
index 5935dcc2c8d9d63d672447ac1fb0ea7157f9221d..664e90917d3ca374ee68a2aca6680f1aa70b6714 100644 (file)
@@ -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"