summaryrefslogtreecommitdiffstats
path: root/usr.bin/wc/wc.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2015-02-11 17:56:24 +0000
committermarcel <marcel@FreeBSD.org>2015-02-11 17:56:24 +0000
commit358bcf1eb34a30dd921c6270d38ef870582bbf6c (patch)
tree700902b197a7740742e27e6af669f88b7bb77821 /usr.bin/wc/wc.c
parent683ca6b704761afcbc4353bde70554feed229c96 (diff)
downloadFreeBSD-src-358bcf1eb34a30dd921c6270d38ef870582bbf6c.zip
FreeBSD-src-358bcf1eb34a30dd921c6270d38ef870582bbf6c.tar.gz
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@
Diffstat (limited to 'usr.bin/wc/wc.c')
-rw-r--r--usr.bin/wc/wc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c
index 79ac4a0..9d51ab2 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);
OpenPOWER on IntegriCloud