Browse Source

Use explicit fflush() instead of setvbuf()

Flushing after every line when printing to console is desirable when
running with systemd but setvbuf() has slightly different semantics
on Windows that causes warnings.  Just do an explicit fflush() after
each line print to console instead.
0.10
Adam Weiss 10 years ago
parent
commit
e982b574a5
  1. 1
      src/init.cpp
  2. 1
      src/util.cpp

1
src/init.cpp

@ -630,7 +630,6 @@ bool AppInit2(boost::thread_group& threadGroup)
fPrintToConsole = GetBoolArg("-printtoconsole", false); fPrintToConsole = GetBoolArg("-printtoconsole", false);
fLogTimestamps = GetBoolArg("-logtimestamps", true); fLogTimestamps = GetBoolArg("-logtimestamps", true);
fLogIPs = GetBoolArg("-logips", false); fLogIPs = GetBoolArg("-logips", false);
setvbuf(stdout, NULL, _IOLBF, 0);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
bool fDisableWallet = GetBoolArg("-disablewallet", false); bool fDisableWallet = GetBoolArg("-disablewallet", false);
#endif #endif

1
src/util.cpp

@ -211,6 +211,7 @@ int LogPrintStr(const std::string &str)
{ {
// print to console // print to console
ret = fwrite(str.data(), 1, str.size(), stdout); ret = fwrite(str.data(), 1, str.size(), stdout);
fflush(stdout);
} }
else if (fPrintToDebugLog && AreBaseParamsConfigured()) else if (fPrintToDebugLog && AreBaseParamsConfigured())
{ {

Loading…
Cancel
Save