Kernel/debug - Added indicator when formatted debug string overflows
authorJohn Hodge <[email protected]>
Tue, 10 Sep 2013 00:27:58 +0000 (08:27 +0800)
committerJohn Hodge <[email protected]>
Tue, 10 Sep 2013 00:27:58 +0000 (08:27 +0800)
KernelLand/Kernel/debug.c

index 7e8acba..a378ae8 100644 (file)
@@ -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 ;
 }
 

UCC git Repository :: git.ucc.asn.au