summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2005-11-14 10:46:27 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2005-11-14 10:46:27 +0000
commitd7ffbc127584135dbcd60869217aa7f3d45dcf70 (patch)
tree080261d01ad16c8adf82cc281116016ac7a38b18
parent82c19f950c446354c9ef100e0f938ec61db25010 (diff)
Stop debug+timestamp using the common timestamp buffer, because it can
interfere with data that's already in there.
-rw-r--r--doc/doc-txt/ChangeLog7
-rw-r--r--src/src/debug.c13
2 files changed, 15 insertions, 5 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index a938e2643..9bb25b182 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.254 2005/11/11 10:02:04 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.255 2005/11/14 10:46:27 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -64,6 +64,11 @@ PH/06 When a client host used a correct literal IP address in a HELO or EHLO
if it matched the actual IP address. This has been tidied up so that it
doesn't show the same IP address twice.
+PH/07 When both +timestamp and +memory debugging was on, the value given by
+ $tod_xxx expansions could be wrong, because the tod_stamp() function was
+ called by the debug printing, thereby overwriting the timestamp buffer.
+ Debugging no longer uses the tod_stamp() function when +timestamp is set.
+
Exim version 4.54
-----------------
diff --git a/src/src/debug.c b/src/src/debug.c
index e3d43641b..59345d210 100644
--- a/src/src/debug.c
+++ b/src/src/debug.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/debug.c,v 1.3 2005/01/04 10:00:42 ph10 Exp $ */
+/* $Cambridge: exim/src/src/debug.c,v 1.4 2005/11/14 10:46:27 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -161,14 +161,19 @@ debug_vprintf(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++;
}