From b4de8aa9998a7542cd33463122c5734be64c9662 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 0463539958349..80d68c03a3836 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))