From 37a37e44591bcec0c89bddff98da60aeb48c6721 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 21 Jul 2010 11:59:26 +0200 Subject: [PATCH] Fix printing of JSON values. --- src/action_show_graph_json.c | 3 ++- src/graph.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/action_show_graph_json.c b/src/action_show_graph_json.c index 36de76c..d365205 100644 --- a/src/action_show_graph_json.c +++ b/src/action_show_graph_json.c @@ -46,7 +46,8 @@ static int write_buffer (char *buffer, size_t buffer_size) /* {{{ */ while (buffer_size > 0) { - status = fwrite (buffer, buffer_size, /* nmemb = */ 1, stdout); + status = fwrite (buffer, /* size = */ 1, + /* nmemb = */ buffer_size, stdout); if (status == 0) return (errno); diff --git a/src/graph.c b/src/graph.c index f664be1..b654a1f 100644 --- a/src/graph.c +++ b/src/graph.c @@ -627,6 +627,9 @@ int graph_to_json (const graph_config_t *cfg, (unsigned char *) "select", (unsigned int) strlen ("select")); ident_to_json (cfg->select, handler); + yajl_gen_string (handler, + (unsigned char *) "instances", + (unsigned int) strlen ("instances")); yajl_gen_array_open (handler); for (i = 0; i < cfg->instances_num; i++) inst_to_json (cfg->instances[i], handler); -- 2.30.2