aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2010-11-17 20:51:36 -0500
committerGavin Andresen <gavinandresen@gmail.com>2010-11-17 20:51:36 -0500
commit11c570cfb4a314d63f461ca107ed1db8638f1509 (patch)
tree66846ec2b2f24065c749a999ee2d395d0efab3b0
parent8595d31ee86f2ccd0672169b256efc1bb8c456d4 (diff)
parentc4679ad0f1d4370d2d441c5091358d16854b8102 (diff)
downloadbitcoin-11c570cfb4a314d63f461ca107ed1db8638f1509.tar.xz
Merge remote branch 'refs/remotes/svn/trunk' into svn
-rw-r--r--util.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/util.cpp b/util.cpp
index 5ba0fb510d..7576beabaa 100644
--- a/util.cpp
+++ b/util.cpp
@@ -158,17 +158,14 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
{
// print to debug.log
static FILE* fileout = NULL;
- static int64 nOpenTime = 0;
- if (GetTime()-nOpenTime > 10 * 60)
+ if (!fileout)
{
- if (fileout)
- fclose(fileout);
char pszFile[MAX_PATH+100];
GetDataDir(pszFile);
strlcat(pszFile, "/debug.log", sizeof(pszFile));
fileout = fopen(pszFile, "a");
- nOpenTime = GetTime();
+ setbuf(fileout, NULL); // unbuffered
}
if (fileout)
{
@@ -178,15 +175,15 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
va_start(arg_ptr, pszFormat);
ret = vfprintf(fileout, pszFormat, arg_ptr);
va_end(arg_ptr);
- fflush(fileout);
}
}
#ifdef __WXMSW__
if (fPrintToDebugger)
{
- // accumulate a line at a time
static CCriticalSection cs_OutputDebugStringF;
+
+ // accumulate a line at a time
CRITICAL_BLOCK(cs_OutputDebugStringF)
{
static char pszBuffer[50000];