Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Nov 2014 01:36:20 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274210 - head/usr.bin/wc
Message-ID:  <201411070136.sA71aKJm000271@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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");
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411070136.sA71aKJm000271>