From cdc44c2b78ae88bf62bb870969ba814d3a79e71c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 9 Sep 2019 10:17:32 +0200 Subject: [PATCH] do not log carriage return Some commands (like ssh) end their output with carriage return (\r) and new line (\n). Just cutting the new line before sending to syslog may have undesired effects of unprintable characters. Reading cronie logs with journalctl I can see: Sep 06 16:50:01 linux CROND[152575]: [96B blob data] Adding switch --all for unprintable characters it shows: Sep 06 16:50:01 linux CROND[152575]: (root) CMDOUT (Warning: Permanently added '10.52.33.217' (ED25519) to the list of known hosts.^M) Just skip carriage return for syslog to prevent this. --- src/do_command.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/do_command.c b/src/do_command.c index 45c49f7..ed56775 100644 --- a/src/do_command.c +++ b/src/do_command.c @@ -506,6 +506,8 @@ static int child_process(entry * e, char **jobenv) { */ while (EOF != (ch = getc(in))) { + if (ch == '\r') + continue; bytes++; if (mail) putc(ch, mail); -- 2.50.1