From 9dbb9e22b1c5e586f3d64236e4301548ef409231 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 10 Sep 2013 08:27:58 +0800 Subject: [PATCH] Kernel/debug - Added indicator when formatted debug string overflows --- KernelLand/Kernel/debug.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/KernelLand/Kernel/debug.c b/KernelLand/Kernel/debug.c index 7e8acba7..a378ae81 100644 --- a/KernelLand/Kernel/debug.c +++ b/KernelLand/Kernel/debug.c @@ -94,12 +94,13 @@ void Debug_DbgOnlyFmt(const char *format, va_list args) void Debug_Fmt(int bUseKTerm, const char *format, va_list args) { char buf[DEBUG_MAX_LINE_LEN]; -// int len; buf[DEBUG_MAX_LINE_LEN-1] = 0; - /*len = */vsnprintf(buf, DEBUG_MAX_LINE_LEN-1, format, args); - //if( len < DEBUG_MAX_LINE ) - // do something + int len = vsnprintf(buf, DEBUG_MAX_LINE_LEN-1, format, args); Debug_Puts(bUseKTerm, buf); + if( len > DEBUG_MAX_LINE_LEN-1 ) { + // do something + Debug_Puts(bUseKTerm, "[...]"); + } return ; } -- 2.20.1