summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-04-14 23:31:05 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2018-04-14 23:31:05 +0100
commit3203e7baa4148a7068bc69caef3b63dcb3971b92 (patch)
treeaa91c6cf7074a7b8dedf1afb168aba4b38424900
parent3d4b2f5b9ec095971f7ec86a730691e603aa6673 (diff)
Logging: fix syslog logging for syslog_timestamp=no and log_selector +millisec
also syslog_pid=no and log_selector +pid
-rw-r--r--doc/doc-txt/ChangeLog5
-rw-r--r--src/src/log.c15
2 files changed, 15 insertions, 5 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 83a37d515..b4c98572f 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -210,6 +210,11 @@ JH/38 DKIM: accept Ed25519 pubkeys in SubjectPublicKeyInfo-wrapped form,
since the IETF WG has not yet settled on that versus the original
"bare" representation.
+JH/39 Fix syslog logging for syslog_timestamp=no and log_selector +millisec.
+ Previously the millisecond value corrupted the output.
+ Fix also for syslog_pid=no and log_selector +pid, for which the pid
+ corrupted the output.
+
Exim version 4.90
-----------------
diff --git a/src/src/log.c b/src/src/log.c
index 755119813..16f58d26b 100644
--- a/src/src/log.c
+++ b/src/src/log.c
@@ -134,22 +134,27 @@ can get here if there is a failure to open the panic log.)
Arguments:
priority syslog priority
- s the string to be written, the string may be modified!
+ s the string to be written
Returns: nothing
*/
static void
-write_syslog(int priority, uschar *s)
+write_syslog(int priority, const uschar *s)
{
int len, pass;
int linecount = 0;
if (running_in_test_harness) return;
-if (!syslog_timestamp) s += log_timezone ? 26 : 20;
if (!syslog_pid && LOGGING(pid))
- memmove(s + pid_position[0], s + pid_position[1], pid_position[1] - pid_position[0]);
+ s = string_sprintf("%.*s%s", (int)pid_position[0], s, s + pid_position[1]);
+if (!syslog_timestamp)
+ {
+ len = log_timezone ? 26 : 20;
+ if (LOGGING(millisec)) len += 4;
+ s += len;
+ }
len = Ustrlen(s);
@@ -172,7 +177,7 @@ for (pass = 0; pass < 2; pass++)
{
int i;
int tlen;
- uschar *ss = s;
+ const uschar * ss = s;
for (i = 1, tlen = len; tlen > 0; i++)
{
int plen = tlen;