diff options
Diffstat (limited to 'kern/log.c')
-rw-r--r-- | kern/log.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -22,6 +22,7 @@ #include <stddef.h> #include <stdio.h> #include <stdint.h> +#include <string.h> #include <kern/cbuf.h> #include <kern/init.h> @@ -457,6 +458,7 @@ log_vmsg(unsigned int level, const char *format, va_list ap) unsigned long flags; int nr_chars; size_t size; + char *ptr; log_record_init_produce(&record, level); nr_chars = vsnprintf(record.buffer, sizeof(record.buffer), format, ap); @@ -466,6 +468,13 @@ log_vmsg(unsigned int level, const char *format, va_list ap) goto out; } + ptr = strchr(record.buffer, '\n'); + + if (ptr != NULL) { + *ptr = '\0'; + nr_chars = ptr - record.buffer; + } + assert(nr_chars >= 0); size = offsetof(struct log_record, buffer) + nr_chars + 1; |