ctdb-scripts: Avoid errors for uninitialised counters
[gd/samba-autobuild/.git] / ctdb / config / functions
index 56105aab1655b3b75482a901ff74def1c84cec6f..5a7737ec34ab44718c5644b7f1e0f7fc441c6adb 100755 (executable)
@@ -754,7 +754,7 @@ ctdb_counter_get()
 {
        _ctdb_counter_common "$1"
        # unary counting!
-       _val=$(wc -c <"$_counter_file" 2>/dev/null || echo 0)
+       _val=$(wc -c 2>/dev/null <"$_counter_file" || echo 0)
        # Strip leading spaces from output of wc (on freebsd)
        # shellcheck disable=SC2086
        echo $_val