Browse Source

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
0.15
Wladimir J. van der Laan 8 years ago
parent
commit
7e96ecf075
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
  1. 3
      src/netbase.cpp

3
src/netbase.cpp

@ -668,13 +668,14 @@ std::string NetworkErrorString(int err)
std::string NetworkErrorString(int err) std::string NetworkErrorString(int err)
{ {
char buf[256]; char buf[256];
const char *s = buf;
buf[0] = 0; buf[0] = 0;
/* Too bad there are two incompatible implementations of the /* Too bad there are two incompatible implementations of the
* thread-safe strerror. */ * thread-safe strerror. */
const char *s;
#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */ #ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
s = strerror_r(err, buf, sizeof(buf)); s = strerror_r(err, buf, sizeof(buf));
#else /* POSIX variant always returns message in buffer */ #else /* POSIX variant always returns message in buffer */
s = buf;
if (strerror_r(err, buf, sizeof(buf))) if (strerror_r(err, buf, sizeof(buf)))
buf[0] = 0; buf[0] = 0;
#endif #endif

Loading…
Cancel
Save