fix for iynvalid jsoninfo output
[lede-routing/.git] / olsrd / patches / 001-fix-jsoninfo.patch
1 --- a/lib/jsoninfo/src/olsrd_jsoninfo.c
2 +++ b/lib/jsoninfo/src/olsrd_jsoninfo.c
3 @@ -1283,8 +1283,11 @@ send_info(unsigned int send_what, int the_socket)
4    abuf_init(&abuf, 32768);
5  
6   // only add if outputing JSON
7 -  if (send_what & SIW_ALL) abuf_json_open_array_entry(&abuf);
8 -
9 +  if (send_what & SIW_ALL) {
10 +    abuf_json_open_array_entry(&abuf);
11 +    entrynumber[0] = 0;
12 +    currentjsondepth = 0;
13 +  }
14    if ((send_what & SIW_LINKS) == SIW_LINKS) ipc_print_links(&abuf);
15    if ((send_what & SIW_NEIGHBORS) == SIW_NEIGHBORS) ipc_print_neighbors(&abuf);
16    if ((send_what & SIW_TOPOLOGY) == SIW_TOPOLOGY) ipc_print_topology(&abuf);