From: Michael Tremer Date: Sat, 22 Sep 2018 12:05:06 +0000 (+0100) Subject: util: Fail silently when directory already exists X-Git-Tag: 010~31 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fnetwork.git;a=commitdiff_plain;h=728483015215f49d36b75097b58eda1a23b6ff7f util: Fail silently when directory already exists Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.util b/src/functions/functions.util index 1be6dc14..31c16319 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -251,6 +251,11 @@ file_get_age() { make_directory() { local path="${1}" + # Exit silently when directory already exists + if [ -d "${path}" ]; then + return ${EXIT_OK} + fi + if ! mkdir -p "${path}"; then log ERROR "Could not create directory ${path}" return ${EXIT_ERROR}