Replace remaining fprintf with tfm::format manually

Github-Pull: #16205
Rebased-From: fa8f195195
This commit is contained in:
MarcoFalke
2019-06-13 09:43:24 -04:00
parent beb09f09b3
commit 79745d1752
5 changed files with 8 additions and 10 deletions

View File

@@ -499,7 +499,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;
}

View File

@@ -827,7 +827,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;
}

View File

@@ -106,14 +106,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)));