[4.1] e76461b Don't quote NL in panic messages
Lasse Karstensen
lkarsten at varnish-software.com
Thu Jan 14 15:15:06 CET 2016
commit e76461b7055cf2bcdc46ddcd3ee3d1a35195b12e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Nov 24 14:12:46 2015 +0000
Don't quote NL in panic messages
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 368d359..11578ce 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -117,7 +117,8 @@ mgt_panic_record(pid_t r)
VTIM_format(VTIM_real(), time_str);
VSB_printf(child_panic, "Last panic at: %s\n", time_str);
VSB_quote(child_panic, heritage.panic_str,
- strnlen(heritage.panic_str, heritage.panic_str_len), 0);
+ strnlen(heritage.panic_str, heritage.panic_str_len),
+ VSB_QUOTE_NONL);
AZ(VSB_finish(child_panic));
MGT_complain(C_ERR, "Child (%jd) %s",
(intmax_t)r, VSB_data(child_panic));
diff --git a/include/vsb.h b/include/vsb.h
index eefaa12..61b64c0 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -75,6 +75,7 @@ int VSB_finish(struct vsb *);
char *VSB_data(const struct vsb *);
ssize_t VSB_len(const struct vsb *);
void VSB_delete(struct vsb *);
+#define VSB_QUOTE_NONL 1
void VSB_quote(struct vsb *s, const char *p, int len, int how);
void VSB_indent(struct vsb *, int);
#ifdef __cplusplus
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index 63c196d..92abdf2 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -519,7 +519,10 @@ VSB_quote(struct vsb *s, const char *p, int len, int how)
(void)VSB_putc(s, *q);
break;
case '\n':
- (void)VSB_cat(s, "\\n");
+ if (how & VSB_QUOTE_NONL)
+ (void)VSB_cat(s, "\n");
+ else
+ (void)VSB_cat(s, "\\n");
break;
case '\r':
(void)VSB_cat(s, "\\r");
More information about the varnish-commit
mailing list