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

Marcel Moolenaar marcel at FreeBSD.org
Fri Nov 7 01:36:21 UTC 2014


Author: marcel
Date: Fri Nov  7 01:36:20 2014
New Revision: 274210
URL: https://svnweb.freebsd.org/changeset/base/274210

Log:
  Fix a SIGSEGV when emitting XML or JSON when reading stdin. In that
  case the file variable is NULL.

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

Modified: head/usr.bin/wc/wc.c
==============================================================================
--- head/usr.bin/wc/wc.c	Fri Nov  7 00:59:40 2014	(r274209)
+++ head/usr.bin/wc/wc.c	Fri Nov  7 01:36:20 2014	(r274210)
@@ -164,8 +164,6 @@ show_cnt(const char *file, uintmax_t lin
 		siginfo = 0;
 	}
 
-	xo_emit("{ek:filename/%s}", file);
-
 	if (doline)
 		xo_emit_h(xop, " {:lines/%7ju/%ju}", linect);
 	if (doword)
@@ -175,7 +173,7 @@ show_cnt(const char *file, uintmax_t lin
 	if (dolongline)
 		xo_emit_h(xop, " {:long-lines/%7ju/%ju}", llct);
 	if (file != NULL)
-		xo_emit_h(xop, " {d:filename/%s}\n", file);
+		xo_emit_h(xop, " {:filename/%s}\n", file);
 	else
 		xo_emit_h(xop, "\n");
 }


More information about the svn-src-all mailing list