aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-06-09 19:32:27 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-06-09 19:32:34 +0200
commitca424e242a718658785053217fd66bfb39b5e791 (patch)
tree4fca5dbecaa01d0145b0782aad5fd9c137644d4f /src
parent93e38d5c06d9b32326585121b46bb59041d7cfed (diff)
parent3f05a9e681c4b72d99ddda8ccb6911d6ffad44ec (diff)
Merge bitcoin/bitcoin#22200: zmq: use std::string in zmqError()
3f05a9e681c4b72d99ddda8ccb6911d6ffad44ec zmq: use msg: prefix over errno= in zmqError (fanquake) 9a7cb57bbc61b2dfb772f8486db2a44c1673983a zmq: use std::string in zmqError() (fanquake) Pull request description: This is two minor changes. The first is to change `zmqError` to take a `const std::string&` instead of a `const char*`. The second is to change the second portion of `zmqError` to print `msg: message` rather than `errno=message`, given that `zmq_strerror` returns a message. To me, this seems more readable / useful than output like: `Error: Unable to initialize context errno=No such file or directory`. ACKs for top commit: practicalswift: cr ACK 3f05a9e681c4b72d99ddda8ccb6911d6ffad44ec instagibbs: utACK https://github.com/bitcoin/bitcoin/pull/22200/commits/3f05a9e681c4b72d99ddda8ccb6911d6ffad44ec theStack: Code-Review ACK 3f05a9e681c4b72d99ddda8ccb6911d6ffad44ec Tree-SHA512: 197cf381e8b3ced271d0e575e0c6d8e5e9ed93c4b284338b17873c5232eaabe64d6c4b66e1aeb5e76befc89e316abae2b28b7fd760f178481d7b9f4e3f85da67
Diffstat (limited to 'src')
-rw-r--r--src/zmq/zmqutil.cpp8
-rw-r--r--src/zmq/zmqutil.h4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/zmq/zmqutil.cpp b/src/zmq/zmqutil.cpp
index f07a4ae9fd..b0f12388e5 100644
--- a/src/zmq/zmqutil.cpp
+++ b/src/zmq/zmqutil.cpp
@@ -5,10 +5,12 @@
#include <zmq/zmqutil.h>
#include <logging.h>
-
#include <zmq.h>
-void zmqError(const char* str)
+#include <cerrno>
+#include <string>
+
+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));
}
diff --git a/src/zmq/zmqutil.h b/src/zmq/zmqutil.h
index 4c1df5d6db..90c0b00edb 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 <string>
+
+void zmqError(const std::string& str);
#endif // BITCOIN_ZMQ_ZMQUTIL_H