diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-06-17 06:06:34 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-06-17 06:06:41 -0400 |
commit | 1a274bce4b6e726fb54983398d5aed3586214c73 (patch) | |
tree | dbea6bfd83b1818b43a5d0a246c7d2a341d52e4a /src/init.cpp | |
parent | f3855781fdc52382b7ccfd0060623fa8ab1541b5 (diff) | |
parent | fa8f195195945ce6258199af0461e3fbfbc1236d (diff) |
Merge #16205: Refactor: Replace fprintf with tfm::format
fa8f195195 Replace remaining fprintf with tfm::format manually (MarcoFalke)
fac03ec43a scripted-diff: Replace fprintf with tfm::format (MarcoFalke)
fa72a64b90 tinyformat: Add doc to Bitcoin Core specific strprintf (MarcoFalke)
Pull request description:
This should be a refactor except in the cases where we use the wrong format specifier [1], in which case this patch is a bug fix.
[1] : e.g. depends: Add libevent compatibility patch for windows #8730
ACKs for commit fa8f19:
promag:
ACK fa8f195195945ce6258199af0461e3fbfbc1236d. Ideally this should be rebased before merge.
practicalswift:
utACK fa8f195195945ce6258199af0461e3fbfbc1236d
Empact:
ACK https://github.com/bitcoin/bitcoin/pull/16205/commits/fa8f195195945ce6258199af0461e3fbfbc1236d
laanwj:
code review and lightly tested ACK fa8f195195945ce6258199af0461e3fbfbc1236d
jonatack:
ACK fa8f195195945ce6258199af0461e3fbfbc1236d from light code review, building, and running linter/unit tests/extended functional tests.
Tree-SHA512: 65f648b0bc383e3266a5bdb4ad8c8a1908a719635d49e1cd321b91254be24dbc7e22290370178e29b98ddcb3fec0889de9cbae273c7140abc9793d849534a743
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
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))); |