From 9a022988f66619da573e287f5f41aead7e5d7914 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Sun, 23 Aug 1998 22:15:21 +0000 Subject: [PATCH] Fixed bad read references noticed by Jud with Quantify. --- network/main/mktrace.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/network/main/mktrace.c b/network/main/mktrace.c index ebdb51bbe72f..9747338905b0 100644 --- a/network/main/mktrace.c +++ b/network/main/mktrace.c @@ -170,6 +170,7 @@ TimingWriteMessage(const char* fmtstr, ...) { char line[256]; va_list ap; + PRUint32 nb; if (! EnsureLogModule()) return; @@ -177,12 +178,8 @@ TimingWriteMessage(const char* fmtstr, ...) if (gTimingLog->level == PR_LOG_NONE) return; - va_start(ap, fmtstr); - { PRExplodedTime now; - PRUint32 nb; - PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now); /* Print out "YYYYMMDD.HHMMSS.UUUUUU: " */ @@ -191,12 +188,13 @@ TimingWriteMessage(const char* fmtstr, ...) now.tm_year, now.tm_month + 1, now.tm_mday, now.tm_hour, now.tm_min, now.tm_sec, now.tm_usec); - - /* ...followed by the "real" message */ - nb += PR_vsnprintf(line + nb, sizeof(line) - nb - 1, fmtstr, ap); } - PR_LOG(gTimingLog, PR_LOG_NOTICE, (line)); + /* ...followed by the "real" message */ + va_start(ap, fmtstr); + nb += PR_vsnprintf(line + nb, sizeof(line) - nb - 1, fmtstr, ap); + + PR_LOG(gTimingLog, PR_LOG_NOTICE, ("%s", line)); }