summaryrefslogtreecommitdiff
path: root/sysdep/unix
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-03-02 10:01:44 +0100
committerMaria Matejka <mq@ucw.cz>2022-03-02 10:01:44 +0100
commitd071aca7aaf7a4add9e0d1d93029fb9a0fad560a (patch)
tree89999b8a4ab23b2243f8cbfca7bb700e85fae36b /sysdep/unix
parentfcb4dd0c831339c4374ace17d8f2ae6ebfeed279 (diff)
parent2c13759136951ef0e70a3e3c2b2d3c9a387f7ed9 (diff)
Merge commit '2c13759136951ef0e70a3e3c2b2d3c9a387f7ed9' into haugesund
Diffstat (limited to 'sysdep/unix')
-rw-r--r--sysdep/unix/log.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c
index 14d18c01..4e9df069 100644
--- a/sysdep/unix/log.c
+++ b/sysdep/unix/log.c
@@ -309,22 +309,15 @@ die(const char *msg, ...)
void
debug(const char *msg, ...)
{
-#define MAX_DEBUG_BUFSIZE 65536
+#define MAX_DEBUG_BUFSIZE 16384
va_list args;
- static uint bufsize = 4096;
- static char *buf = NULL;
-
- if (!buf)
- buf = mb_alloc(&root_pool, bufsize);
+ char buf[MAX_DEBUG_BUFSIZE];
va_start(args, msg);
if (dbgf)
{
- while (bvsnprintf(buf, bufsize, msg, args) < 0)
- if (bufsize >= MAX_DEBUG_BUFSIZE)
- bug("Extremely long debug output, split it.");
- else
- buf = mb_realloc(buf, (bufsize *= 2));
+ if (bvsnprintf(buf, MAX_DEBUG_BUFSIZE, msg, args) < 0)
+ bug("Extremely long debug output, split it.");
fputs(buf, dbgf);
}