From 399d34850fe953934b6516ac78dfc3c7aed1e10f Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 11 Feb 2015 17:56:24 +0000 Subject: Close the file list before opening the container that holds the totals, otherwise we end up emitting invalid JSON -- provided libxo does not prevent us from doing that. PR: 197499 Submitted by: allanjude@ --- usr.bin/wc/wc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr.bin/wc') diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c index 79ac4a020f3d..9d51ab2fd1c8 100644 --- a/usr.bin/wc/wc.c +++ b/usr.bin/wc/wc.c @@ -140,12 +140,14 @@ main(int argc, char *argv[]) } while(*++argv); } + xo_close_list("file"); + if (total > 1) { xo_open_container("total"); show_cnt("total", tlinect, twordct, tcharct, tlongline); xo_close_container("total"); } - xo_close_list("file"); + xo_close_container("wc"); xo_finish(); exit(errors == 0 ? 0 : 1); -- cgit v1.2.3