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
This commit is contained in:
commit
7e96ecf075
1 changed files with 2 additions and 1 deletions
|
@ -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…
Reference in a new issue