summaryrefslogtreecommitdiffstats
path: root/runtime/debug.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-08 16:36:17 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-08 16:36:17 +0200
commitec56b763b83677d1e9cd02a7ae610caf62e902bb (patch)
treebe7717d7db2fc5bf49b29fa1eb930d1ac51ebfa3 /runtime/debug.c
parentd85efd07e006d4d9031019aa9ac9757d303a8b36 (diff)
downloadrsyslog-ec56b763b83677d1e9cd02a7ae610caf62e902bb.tar.gz
rsyslog-ec56b763b83677d1e9cd02a7ae610caf62e902bb.tar.xz
rsyslog-ec56b763b83677d1e9cd02a7ae610caf62e902bb.zip
bugfix in debug system and more instrumentation to find an issue
bugfix: debug string larger than 1K were improperly displayed. Max size is now 32K, and if a string is even longer it is meaningful truncated.
Diffstat (limited to 'runtime/debug.c')
-rw-r--r--runtime/debug.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/runtime/debug.c b/runtime/debug.c
index fb751efb..7c938008 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -960,7 +960,7 @@ void
dbgprintf(char *fmt, ...)
{
va_list ap;
- char pszWriteBuf[1024];
+ char pszWriteBuf[32*1024];
size_t lenWriteBuf;
if(!(Debug && debugging_on))
@@ -969,6 +969,16 @@ dbgprintf(char *fmt, ...)
va_start(ap, fmt);
lenWriteBuf = vsnprintf(pszWriteBuf, sizeof(pszWriteBuf), fmt, ap);
va_end(ap);
+
+ if(lenWriteBuf >= sizeof(pszWriteBuf)) {
+ /* if we need to truncate, do it in a somewhat useful way... */
+ pszWriteBuf[sizeof(pszWriteBuf) - 5] = '!';
+ pszWriteBuf[sizeof(pszWriteBuf) - 4] = '.';
+ pszWriteBuf[sizeof(pszWriteBuf) - 3] = '.';
+ pszWriteBuf[sizeof(pszWriteBuf) - 2] = '.';
+ pszWriteBuf[sizeof(pszWriteBuf) - 1] = '\n';
+ lenWriteBuf = sizeof(pszWriteBuf);
+ }
dbgprint(NULL, pszWriteBuf, lenWriteBuf);
}