summaryrefslogtreecommitdiffstats
path: root/libnetdata
diff options
context:
space:
mode:
authorTimotej S <6674623+underhood@users.noreply.github.com>2020-07-08 16:20:47 +0200
committerGitHub <noreply@github.com>2020-07-08 16:20:47 +0200
commit11e4ac13577ebe65b24e7b2a7bd594ae5e128539 (patch)
tree372559562b5777d632c34492d64e68cc3a35968c /libnetdata
parent628598c4d5d401f41f5bb43dfb2951c0bae0703e (diff)
fix ACLK protocol version always parsed as 0 (#9502)
Diffstat (limited to 'libnetdata')
-rw-r--r--libnetdata/json/json.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libnetdata/json/json.c b/libnetdata/json/json.c
index d2407ba405..bd164aeffc 100644
--- a/libnetdata/json/json.c
+++ b/libnetdata/json/json.c
@@ -161,6 +161,16 @@ static inline void json_jsonc_set_boolean(JSON_ENTRY *e,int value) {
e->data.boolean = value;
}
+static inline void json_jsonc_set_integer(JSON_ENTRY *e, char *key, int64_t value) {
+ size_t len = strlen(key);
+ if(len > JSON_NAME_LEN)
+ len = JSON_NAME_LEN;
+ e->type = JSON_NUMBER;
+ memcpy(e->name, key, len);
+ e->name[len] = 0;
+ e->data.number = value;
+}
+
/**
* Parse Array
*
@@ -449,6 +459,9 @@ size_t json_walk(json_object *t, void *callback_data, int (*callback_function)(s
} else if (type == json_type_boolean) {
json_jsonc_set_boolean(&e,json_object_get_boolean(val));
callback_function(&e);
+ } else if (type == json_type_int) {
+ json_jsonc_set_integer(&e,key,json_object_get_int64(val));
+ callback_function(&e);
}
}