From: Florian Forster Date: Wed, 21 Jul 2010 09:59:26 +0000 (+0200) Subject: Fix printing of JSON values. X-Git-Tag: v4.0.0~80 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=37a37e44591bcec0c89bddff98da60aeb48c6721;p=collection4.git Fix printing of JSON values. --- 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);