jsoninfo: ensure output is wrapped in curly braces.
authorScott Kidder <kidder.scott@gmail.com>
Thu, 15 Aug 2013 17:06:23 +0000 (10:06 -0700)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 15 Aug 2013 21:18:13 +0000 (23:18 +0200)
lib/jsoninfo/src/olsrd_jsoninfo.c

index 3694b48..3f7b7b9 100644 (file)
@@ -1283,7 +1283,7 @@ send_info(unsigned int send_what, int the_socket)
   abuf_init(&abuf, 32768);
 
  // only add if outputing JSON
-  if (send_what & SIW_ALL) abuf_puts(&abuf, "{\n");
+  if (send_what & SIW_ALL) abuf_json_open_array_entry(&abuf);
 
   if ((send_what & SIW_LINKS) == SIW_LINKS) ipc_print_links(&abuf);
   if ((send_what & SIW_NEIGHBORS) == SIW_NEIGHBORS) ipc_print_neighbors(&abuf);
@@ -1305,7 +1305,7 @@ send_info(unsigned int send_what, int the_socket)
     abuf_json_int(&abuf, "timeSinceStartup", now_times);
     if(*uuid != 0)
       abuf_json_string(&abuf, "uuid", uuid);
-    abuf_puts(&abuf, "}\n");
+    abuf_json_close_array_entry(&abuf);
   }
 
   /* this outputs the olsrd.conf text directly, not JSON */