From 7d58cd0e6bedc288ef8ba78830c50d131af540fb Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Thu, 30 Sep 2021 22:38:11 -0300 Subject: [PATCH] cli: Ignore libevent warnings --- src/pivx-cli.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/pivx-cli.cpp b/src/pivx-cli.cpp index 04635399583499..80d68c03a38365 100644 --- a/src/pivx-cli.cpp +++ b/src/pivx-cli.cpp @@ -52,6 +52,18 @@ std::string HelpMessageCli() return strUsage; } +/** libevent event log callback */ +static void libevent_log_cb(int severity, const char *msg) +{ +#ifndef EVENT_LOG_ERR // EVENT_LOG_ERR was added in 2.0.19; but before then _EVENT_LOG_ERR existed. +# define EVENT_LOG_ERR _EVENT_LOG_ERR +#endif + // Ignore everything other than errors + if (severity >= EVENT_LOG_ERR) { + throw std::runtime_error(strprintf("libevent error: %s", msg)); + } +} + ////////////////////////////////////////////////////////////////////////////// // // Start @@ -359,6 +371,7 @@ int main(int argc, char* argv[]) fprintf(stderr, "Error: Initializing networking failed\n"); return EXIT_FAILURE; } + event_set_log_callback(&libevent_log_cb); try { if (!AppInitRPC(argc, argv))