summaryrefslogtreecommitdiff
path: root/usr.bin/wc
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2014-11-07 01:36:20 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2014-11-07 01:36:20 +0000
commit985c93f0b4c024d32da582b93d06602d3223cf39 (patch)
treee449fa69444e93b61490fd780e72c5b3947794fc /usr.bin/wc
parentb78618fbda97e25cb38b86092c4f2bb7f4cd8567 (diff)
downloadsrc-test2-985c93f0b4c024d32da582b93d06602d3223cf39.tar.gz
src-test2-985c93f0b4c024d32da582b93d06602d3223cf39.zip
Fix a SIGSEGV when emitting XML or JSON when reading stdin. In that
case the file variable is NULL.
Notes
Notes: svn path=/head/; revision=274210
Diffstat (limited to 'usr.bin/wc')
-rw-r--r--usr.bin/wc/wc.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c
index d70c1a3873f7..79ac4a020f3d 100644
--- a/usr.bin/wc/wc.c
+++ b/usr.bin/wc/wc.c
@@ -164,8 +164,6 @@ show_cnt(const char *file, uintmax_t linect, uintmax_t wordct,
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 linect, uintmax_t wordct,
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");
}