From 32f84edac5cb81c6a11548407c65a79fc27ead1a Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 18 Mar 2020 11:04:58 -0700 Subject: [PATCH] dsynth - Fix escaping, skipped count * Fix backslashes in info fields that were causing json to implode. * Remove parens around (%d) skipped count reporting so the field can be sorted. Reported-by: tuxillo --- usr.bin/dsynth/build.c | 8 +++++--- usr.bin/dsynth/html.c | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.bin/dsynth/build.c b/usr.bin/dsynth/build.c index c02cf1a4d0..8064f48f30 100644 --- a/usr.bin/dsynth/build.c +++ b/usr.bin/dsynth/build.c @@ -1069,10 +1069,12 @@ workercomplete(worker_t *work) scount = buildskipcount_dueto(pkg, 1); buildskipcount_dueto(pkg, 0); - if (scount) - snprintf(skipbuf, sizeof(skipbuf), " (%d)", scount); - else + if (scount) { + snprintf(skipbuf, sizeof(skipbuf), " %d", + scount); + } else { skipbuf[0] = 0; + } ++BuildFailCount; dlog(DLOG_FAIL | DLOG_RED, diff --git a/usr.bin/dsynth/html.c b/usr.bin/dsynth/html.c index 92e01b7a89..f9c26a3375 100644 --- a/usr.bin/dsynth/html.c +++ b/usr.bin/dsynth/html.c @@ -67,7 +67,8 @@ dequote(const char *reason) int i; for (i = 0; reason[i]; ++i) { - if (reason[i] == '\"' || reason[i] == '\n') { + if (reason[i] == '\"' || reason[i] == '\n' || + reason[i] == '\\') { if (reason != buf) { snprintf(buf, sizeof(buf), "%s", reason); reason = buf; -- 2.41.0