]> git.ipfire.org Git - people/stevee/network.git/commitdiff
util: Silence fwrite on error
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 6 Sep 2014 13:08:28 +0000 (15:08 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 6 Sep 2014 13:08:28 +0000 (15:08 +0200)
src/functions/functions.util

index 79ec87db7e579fa078f0f37f8443332ee4feec19..179656ea505fdecfe450b6d020b422477a1ebffd 100644 (file)
@@ -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() {