]> git.pld-linux.org Git - packages/lighttpd.git/blame - data_string_print_escape.patch
- format " properly in accesslog format when printing config with lighttpd -pf CONFIG...
[packages/lighttpd.git] / data_string_print_escape.patch
CommitLineData
1f232d82
ER
1--- lighttpd-1.4.26/src/data_string.c~ 2010-05-25 00:53:55.000000000 +0300
2+++ lighttpd-1.4.26/src/data_string.c 2010-05-25 00:53:59.407739779 +0300
3@@ -70,8 +70,19 @@
4 static void data_string_print(const data_unset *d, int depth) {
5 data_string *ds = (data_string *)d;
6 UNUSED(depth);
7+ unsigned int i = 0;
8
9- fprintf(stdout, "\"%s\"", ds->value->used ? ds->value->ptr : "");
10+ // print out the string as is, except prepend " with backslash
11+ putc('"', stdout);
12+ for (i = 0; i < ds->value->used - 1; i++) {
13+ unsigned char c = ds->value->ptr[i];
14+ if (c == '"') {
15+ fputs("\\\"", stdout);
16+ } else {
17+ putc(c, stdout);
18+ }
19+ }
20+ putc('"', stdout);
21 }
22
23
This page took 0.035523 seconds and 4 git commands to generate.