commit db7c404: [Minor] Ensure that log line is separated by space

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jul 27 15:35:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-27 15:04:00 +0100
URL: https://github.com/rspamd/rspamd/commit/db7c404ef5730e610c93fa810580892b41ddcdaa

[Minor] Ensure that log line is separated by space

---
 src/libserver/logger/logger_console.c | 5 +++++
 src/libserver/logger/logger_file.c    | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/src/libserver/logger/logger_console.c b/src/libserver/logger/logger_console.c
index 3e142fe27..2c1c535d5 100644
--- a/src/libserver/logger/logger_console.c
+++ b/src/libserver/logger/logger_console.c
@@ -279,6 +279,11 @@ rspamd_log_console_log (const gchar *module, const gchar *id,
 			mremain -= mr;
 		}
 
+		/* Ensure that we have a space at the end */
+		if (m > modulebuf && *(m - 1) != ' ') {
+			*(m - 1) = ' ';
+		}
+
 		iov[niov].iov_base = tmpbuf;
 		iov[niov++].iov_len = r;
 		iov[niov].iov_base = modulebuf;
diff --git a/src/libserver/logger/logger_file.c b/src/libserver/logger/logger_file.c
index 81c44f8e7..6531f9916 100644
--- a/src/libserver/logger/logger_file.c
+++ b/src/libserver/logger/logger_file.c
@@ -561,6 +561,11 @@ rspamd_log_file_log (const gchar *module, const gchar *id,
 		mremain -= mr;
 	}
 
+	/* Ensure that we have a space at the end */
+	if (m > modulebuf && *(m - 1) != ' ') {
+		*(m - 1) = ' ';
+	}
+
 	/* Construct IOV for log line */
 	iov[0].iov_base = tmpbuf;
 	iov[0].iov_len = r;


More information about the Commits mailing list