aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-08-04 20:07:48 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2012-08-04 20:07:48 +0300
commit365cd1ef4cde229e19bbcad3c26f47d4d700376b (patch)
treea0a2761fb5ff103d283f23a194d5ad90df4018ab /src
parent7ee140e5d91a71311cade4c702a560e90178cb94 (diff)
downloadmailfromd-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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 11a60aba..4b92598c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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
132void 132void
133trace(const char *fmt, ...) 133trace(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}

Return to:

Send suggestions and report system problems to the System administrator.