1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

logging: Make sure ringbuffer messages are terminated with a newline

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit dbb7c550133c92292a7212bdcaaa79f399b0919b)
This commit is contained in:
Amitay Isaacs 2013-05-08 23:29:55 +10:00
parent e6673f2c46
commit 03a96f280f

View File

@ -67,6 +67,12 @@ static void log_ringbuffer_v(const char *format, va_list ap)
if (ret == -1) {
return;
}
/* Log messages longer than MAX_LOG_SIZE are truncated to MAX_LOG_SIZE-1
* bytes. In that case, add a newline.
*/
if (ret >= MAX_LOG_SIZE) {
log_entries[next_entry].message[MAX_LOG_SIZE-2] = '\n';
}
log_entries[next_entry].level = this_log_level;
log_entries[next_entry].t = timeval_current();