[CRIU] [PATCH] log: Don't show time stamp on pr_msg

Cyrill Gorcunov gorcunov at openvz.org
Thu Nov 1 16:55:51 EDT 2012


In case if the pr_err happens before pr_msg,
the string buffer will have dangling timestamp
prefix. Skip it here.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 log.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/log.c b/log.c
index 9629897..5fa1c6b 100644
--- a/log.c
+++ b/log.c
@@ -182,11 +182,13 @@ void print_on_level(unsigned int loglevel, const char *format, ...)
 
 	if (unlikely(loglevel == LOG_MSG)) {
 		fd = STDOUT_FILENO;
+		off = buf_off;
 	} else {
 		if (loglevel > current_loglevel)
 			return;
 		fd = current_logfd;
 		print_ts();
+		off = 0;
 	}
 
 	va_start(params, format);
@@ -195,7 +197,6 @@ void print_on_level(unsigned int loglevel, const char *format, ...)
 
 	size += buf_off;
 
-	off = 0;
 	while (off < size) {
 		ret = write(fd, buffer + off, size - off);
 		if (ret <= 0)
-- 
1.7.7.6



More information about the CRIU mailing list