aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-05-23 19:37:52 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-05-23 19:39:50 +0200
commit7e96ecf075e8633f83ed1e05052402fb6b4d6186 (patch)
treefa7fd7deb5ea046ec032d3b133ab0bcdfa98b106
parentce8176d0389c0bc1eed42d85ad7e6c7f2bed64d9 (diff)
parent58446094519151e2e203944267e592eec2470643 (diff)
downloadbitcoin-7e96ecf075e8633f83ed1e05052402fb6b4d6186.tar.xz
Merge #9539: [net] Avoid initialization to a value that is never read
5844609 [net] Avoid initialization to a value that is never read (practicalswift) Tree-SHA512: 068c3fba58034187f546688bc9b8b7317e0657e797850613fb6289a4efc28637e4d06a0fa5e57480538c6b8340ed6d6a6c6f9a96f130b698d5d60975490a03d8
-rw-r--r--src/netbase.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 2584f571ee..32557dd179 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -668,13 +668,14 @@ std::string NetworkErrorString(int err)
std::string NetworkErrorString(int err)
{
char buf[256];
- const char *s = buf;
buf[0] = 0;
/* Too bad there are two incompatible implementations of the
* thread-safe strerror. */
+ const char *s;
#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
s = strerror_r(err, buf, sizeof(buf));
#else /* POSIX variant always returns message in buffer */
+ s = buf;
if (strerror_r(err, buf, sizeof(buf)))
buf[0] = 0;
#endif