X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fsrc%2Fdebug.c;h=10bc2a505cf4cd918a5fe87f428f7fb723fda427;hb=1f12df4d41f546751e14d52df36172f9bb54cce8;hp=3128b545fb648aa720d26055d25eb3e853cd1d8a;hpb=059ec3d9952740285fb1ebf47961b8aca2eb1b4a;p=exim.git diff --git a/src/src/debug.c b/src/src/debug.c index 3128b545f..10bc2a505 100644 --- a/src/src/debug.c +++ b/src/src/debug.c @@ -1,16 +1,14 @@ -/* $Cambridge: exim/src/src/debug.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2004 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ #include "exim.h" -static uschar debug_buffer[1024]; +static uschar debug_buffer[2048]; static uschar *debug_ptr = debug_buffer; static int debug_prefix_length = 0; @@ -77,7 +75,7 @@ Returns: nothing */ void -debug_print_argv(uschar **argv) +debug_print_argv(const uschar ** argv) { debug_printf("exec"); while (*argv != NULL) debug_printf(" %.256s", *argv++); @@ -148,7 +146,7 @@ get interleaved. Since some calls to debug_printf() don't end with newline, we save up the text until we do get the newline. */ void -debug_printf(char *format, ...) +debug_printf(const char *format, ...) { va_list ap; va_start(ap, format); @@ -157,18 +155,23 @@ va_end(ap); } void -debug_vprintf(char *format, va_list ap) +debug_vprintf(const char *format, va_list ap) { if (debug_file == NULL) return; -/* Various things can be inserted at the start of a line. */ +/* Various things can be inserted at the start of a line. Don't use the +tod_stamp() function for the timestamp, because that will overwrite the +timestamp buffer, which may contain something useful. (This was a bug fix: the ++memory debugging with +timestamp did cause a problem.) */ if (debug_ptr == debug_buffer) { DEBUG(D_timestamp) { - uschar *ts = tod_stamp(tod_log_bare); - sprintf(CS debug_ptr, "%s ", ts + 11); + time_t now = time(NULL); + struct tm *t = timestamps_utc? gmtime(&now) : localtime(&now); + (void) sprintf(CS debug_ptr, "%02d:%02d:%02d ", t->tm_hour, t->tm_min, + t->tm_sec); while(*debug_ptr != 0) debug_ptr++; }