From: Michael Tremer Date: Sat, 6 Sep 2014 13:08:28 +0000 (+0200) Subject: util: Silence fwrite on error X-Git-Tag: 007~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d4e0d5260c9399b5697a3793f072d9b72833f7d;p=network.git util: Silence fwrite on error --- diff --git a/src/functions/functions.util b/src/functions/functions.util index 79ec87db..179656ea 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -135,7 +135,12 @@ function fwrite() { assert isset file shift - print "%s" "$@" >> ${file} + if [ ! -w "${file}" ]; then + log ERROR "${file}: No such file" + return ${EXIT_ERROR} + fi + + print "%s" "$@" >> ${file} 2>/dev/null } function enabled() {