diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-08-04 20:07:48 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-08-04 20:07:48 +0300 |
commit | 365cd1ef4cde229e19bbcad3c26f47d4d700376b (patch) | |
tree | a0a2761fb5ff103d283f23a194d5ad90df4018ab /src | |
parent | 7ee140e5d91a71311cade4c702a560e90178cb94 (diff) | |
download | mailfromd-365cd1ef4cde229e19bbcad3c26f47d4d700376b.tar.gz mailfromd-365cd1ef4cde229e19bbcad3c26f47d4d700376b.tar.bz2 |
Fix trace output.
The c-escape filter used by the trace output stream suppresses
newlines in output. This is harmless when the output goes to
syslog, but when it goes to stderr, all trace lines get concatenated
into a single one on output. To fix this, newline has to be sent
directly to the underlying stream, bypassing the filter.
* src/main.c (trace): Send newline bypassing the c-escape
filter (which would have converted it to the "\n" sequence).
This requires MU commit 1cbbd572.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -126,13 +126,14 @@ open_trace_stream() | |||
126 | "using standard log: %s"), | 126 | "using standard log: %s"), |
127 | mu_strerror(rc)); | 127 | mu_strerror(rc)); |
128 | mf_trace_stream = mf_strecho; | 128 | mf_trace_stream = mf_strecho; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | void | 132 | void |
133 | trace(const char *fmt, ...) | 133 | trace(const char *fmt, ...) |
134 | { | 134 | { |
135 | if (do_trace) { | 135 | if (do_trace) { |
136 | int bval = 0; | ||
136 | va_list ap; | 137 | va_list ap; |
137 | 138 | ||
138 | if (!mf_trace_stream) | 139 | if (!mf_trace_stream) |
@@ -140,7 +141,15 @@ trace(const char *fmt, ...) | |||
140 | 141 | ||
141 | va_start(ap, fmt); | 142 | va_start(ap, fmt); |
142 | mu_stream_vprintf(mf_trace_stream, fmt, ap); | 143 | mu_stream_vprintf(mf_trace_stream, fmt, ap); |
143 | mu_stream_flush(mf_trace_stream); | 144 | bval = 1; |
145 | mu_stream_ioctl(mf_trace_stream, MU_IOCTL_FILTER, | ||
146 | MU_IOCTL_FILTER_SET_DISABLED, | ||
147 | &bval); | ||
148 | mu_stream_write(mf_trace_stream, "\n", 1, NULL); | ||
149 | bval = 0; | ||
150 | mu_stream_ioctl(mf_trace_stream, MU_IOCTL_FILTER, | ||
151 | MU_IOCTL_FILTER_SET_DISABLED, | ||
152 | &bval); | ||
144 | va_end(ap); | 153 | va_end(ap); |
145 | } | 154 | } |
146 | } | 155 | } |