]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
stats module: fix stats.list() returning nothing
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 13 Feb 2018 13:57:22 +0000 (14:57 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 13 Feb 2018 13:59:40 +0000 (14:59 +0100)
I messed this up in 44c2ea6bb0 !465.

NEWS
modules/stats/stats.c

diff --git a/NEWS b/NEWS
index 8fb5cc639730eec2bfe865d7424cf2c740e7ce3e..90056c18a09cdd81dc475f163e99ef84d99f528b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 
 - detect_time_jump module: don't clear cache on suspend-resume (#284)
+- stats module: fix stats.list() returning nothing, regressed in 2.0.0
 
 
 Knot Resolver 2.0.0 (2018-01-31)
index 525175422034b9e10c21875eeeaa887c4bd62c15..f0a517f82fc955bb660d366e628cde7187adb27b 100644 (file)
@@ -313,7 +313,7 @@ static char* stats_list(void *env, struct kr_module *module, const char *args)
        size_t args_len = args ? strlen(args) : 0;
        for (unsigned i = 0; i < metric_const_end; ++i) {
                struct const_metric_elm *elm = &const_metrics[i];
-               if (args && strncmp(elm->key, args, args_len) == 0) {
+               if (!args || strncmp(elm->key, args, args_len) == 0) {
                        json_append_member(root, elm->key, json_mknumber(elm->val));
                }
        }