svn commit: r278590 - head/usr.bin/wc

Marcel Moolenaar marcel at FreeBSD.org
Wed Feb 11 17:56:25 UTC 2015


Author: marcel
Date: Wed Feb 11 17:56:24 2015
New Revision: 278590
URL: https://svnweb.freebsd.org/changeset/base/278590

Log:
  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@

Modified:
  head/usr.bin/wc/wc.c

Modified: head/usr.bin/wc/wc.c
==============================================================================
--- head/usr.bin/wc/wc.c	Wed Feb 11 17:46:35 2015	(r278589)
+++ head/usr.bin/wc/wc.c	Wed Feb 11 17:56:24 2015	(r278590)
@@ -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);


More information about the svn-src-head mailing list