summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-11-07 01:36:20 +0000
committermarcel <marcel@FreeBSD.org>2014-11-07 01:36:20 +0000
commit9563d535f7d78b896c36fb0374ed7d267571e14d (patch)
treee449fa69444e93b61490fd780e72c5b3947794fc
parentb4ed303a9fa2328fa050afd6a2eb3e55dbcf6604 (diff)
downloadFreeBSD-src-9563d535f7d78b896c36fb0374ed7d267571e14d.zip
FreeBSD-src-9563d535f7d78b896c36fb0374ed7d267571e14d.tar.gz
Fix a SIGSEGV when emitting XML or JSON when reading stdin. In that
case the file variable is NULL.
-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 d70c1a3..79ac4a0 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");
}
OpenPOWER on IntegriCloud