[master] 6bdfb43 Don't quote NL in panic messages
Poul-Henning Kamp
phk at FreeBSD.org
Tue Nov 24 15:29:24 CET 2015
commit 6bdfb4376a5fcfeef02fdc83ccc19a12c39ddb10
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 3784f13..8a26eb4 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, "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