refactor: remove tr_snprintf() pt 1 (#2867)

* refactor use fmt instead of tr_snprintf in remote.cc

* refactor use fmt instead of tr_snprintf in daemon.cc

* refactor use fmt instead of tr_snprintf in cli.cc
This commit is contained in:
Charles Kerr
2022-04-02 14:34:29 -05:00
committed by GitHub
parent 1cc9da26ba
commit 392e511f7e
3 changed files with 170 additions and 261 deletions

View File

@@ -692,9 +692,12 @@ static int daemon_start(void* varg, [[maybe_unused]] bool foreground)
if (ev_base == nullptr)
{
char buf[256];
tr_snprintf(buf, sizeof(buf), "Couldn't initialize daemon event state: %s", tr_strerror(errno));
printMessage(logfile, TR_LOG_ERROR, MyName, buf, __FILE__, __LINE__);
auto const error_code = errno;
auto const errmsg = fmt::format(
_("Couldn't initialize daemon: {error} ({error_code})"),
fmt::arg("error", tr_strerror(error_code)),
fmt::arg("error_code", error_code));
printMessage(logfile, TR_LOG_ERROR, MyName, errmsg, __FILE__, __LINE__);
return 1;
}