aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-06-13 09:43:24 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-06-13 11:46:38 -0400
commitfa8f195195945ce6258199af0461e3fbfbc1236d (patch)
tree04586bb1d5ee6b4aa00fc13a89baf7d5a22132c3 /src
parentfac03ec43a15ad547161e37e53ea82482cc508f9 (diff)
downloadbitcoin-fa8f195195945ce6258199af0461e3fbfbc1236d.tar.xz
Replace remaining fprintf with tfm::format manually
Diffstat (limited to 'src')
-rw-r--r--src/bitcoin-cli.cpp2
-rw-r--r--src/bitcoin-tx.cpp2
-rw-r--r--src/init.cpp7
-rw-r--r--src/sync.cpp2
4 files changed, 6 insertions, 7 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 5abaa16958..38010c461e 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -495,7 +495,7 @@ static int CommandLineRPC(int argc, char *argv[])
}
if (strPrint != "") {
- fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str());
+ tfm::format(nRet == 0 ? std::cout : std::cerr, "%s\n", strPrint.c_str());
}
return nRet;
}
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index b0a57712d8..933b34744d 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -828,7 +828,7 @@ static int CommandLineRawTx(int argc, char* argv[])
}
if (strPrint != "") {
- fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str());
+ tfm::format(nRet == 0 ? std::cout : std::cerr, "%s\n", strPrint.c_str());
}
return nRet;
}
diff --git a/src/init.cpp b/src/init.cpp
index 6912b49717..93aa6f21b5 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -108,14 +108,13 @@ static fs::path GetPidFile()
NODISCARD static bool CreatePidFile()
{
- FILE* file = fsbridge::fopen(GetPidFile(), "w");
+ fsbridge::ofstream file{GetPidFile()};
if (file) {
#ifdef WIN32
- fprintf(file, "%d\n", GetCurrentProcessId());
+ tfm::format(file, "%d\n", GetCurrentProcessId());
#else
- fprintf(file, "%d\n", getpid());
+ tfm::format(file, "%d\n", getpid());
#endif
- fclose(file);
return true;
} else {
return InitError(strprintf(_("Unable to create the PID file '%s': %s"), GetPidFile().string(), std::strerror(errno)));
diff --git a/src/sync.cpp b/src/sync.cpp
index 8dfbbf08be..20258d8e9a 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -57,7 +57,7 @@ struct CLockLocation {
std::string ToString() const
{
- return tfm::format(
+ return strprintf(
"%s %s:%s%s (in thread %s)",
mutexName, sourceFile, itostr(sourceLine), (fTry ? " (TRY)" : ""), m_thread_name);
}