aboutsummaryrefslogtreecommitdiff
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
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.
-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
@@ -123,27 +123,36 @@ open_trace_stream()
MU_STREAM_WRITE);
if (rc) {
mu_error(_("cannot create trace stream, "
"using standard log: %s"),
mu_strerror(rc));
mf_trace_stream = mf_strecho;
- }
+ }
}
void
trace(const char *fmt, ...)
{
if (do_trace) {
+ int bval = 0;
va_list ap;
if (!mf_trace_stream)
open_trace_stream();
va_start(ap, fmt);
mu_stream_vprintf(mf_trace_stream, fmt, ap);
- mu_stream_flush(mf_trace_stream);
+ bval = 1;
+ mu_stream_ioctl(mf_trace_stream, MU_IOCTL_FILTER,
+ MU_IOCTL_FILTER_SET_DISABLED,
+ &bval);
+ mu_stream_write(mf_trace_stream, "\n", 1, NULL);
+ bval = 0;
+ mu_stream_ioctl(mf_trace_stream, MU_IOCTL_FILTER,
+ MU_IOCTL_FILTER_SET_DISABLED,
+ &bval);
va_end(ap);
}
}
void
log_status(sfsistat status, SMFICTX *ctx)

Return to:

Send suggestions and report system problems to the System administrator.