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:
Wladimir J. van der Laan 2017-05-23 19:37:52 +02:00 committed by Pasta
parent 324c588db8
commit 0477eb4b39
No known key found for this signature in database
GPG Key ID: D362C9F7142766AE

View File

@ -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