From 9a7cb57bbc61b2dfb772f8486db2a44c1673983a Mon Sep 17 00:00:00 2001 From: fanquake Date: Tue, 8 Jun 2021 13:21:08 +0800 Subject: [PATCH 1/2] zmq: use std::string in zmqError() --- src/zmq/zmqutil.cpp | 6 ++++-- src/zmq/zmqutil.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/zmq/zmqutil.cpp b/src/zmq/zmqutil.cpp index f07a4ae9fd3..cf05dd81ff0 100644 --- a/src/zmq/zmqutil.cpp +++ b/src/zmq/zmqutil.cpp @@ -5,10 +5,12 @@ #include #include - #include -void zmqError(const char* str) +#include +#include + +void zmqError(const std::string& str) { LogPrint(BCLog::ZMQ, "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno)); } diff --git a/src/zmq/zmqutil.h b/src/zmq/zmqutil.h index 4c1df5d6db6..90c0b00edb8 100644 --- a/src/zmq/zmqutil.h +++ b/src/zmq/zmqutil.h @@ -5,6 +5,8 @@ #ifndef BITCOIN_ZMQ_ZMQUTIL_H #define BITCOIN_ZMQ_ZMQUTIL_H -void zmqError(const char* str); +#include + +void zmqError(const std::string& str); #endif // BITCOIN_ZMQ_ZMQUTIL_H From 3f05a9e681c4b72d99ddda8ccb6911d6ffad44ec Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 9 Jun 2021 14:29:44 +0800 Subject: [PATCH 2/2] zmq: use msg: prefix over errno= in zmqError zmq_strerror() converts the passed errno into a description, meaning currently you have output like: "errno=No such file or directory". Using msg: would seem to make more sense here. --- src/zmq/zmqutil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zmq/zmqutil.cpp b/src/zmq/zmqutil.cpp index cf05dd81ff0..b0f12388e5c 100644 --- a/src/zmq/zmqutil.cpp +++ b/src/zmq/zmqutil.cpp @@ -12,5 +12,5 @@ void zmqError(const std::string& str) { - LogPrint(BCLog::ZMQ, "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno)); + LogPrint(BCLog::ZMQ, "zmq: Error: %s, msg: %s\n", str, zmq_strerror(errno)); }