Browse Source

Merge pull request #4479

109849e Bugfix: strerror_r can return an error, and if it does, POSIX does not specify the content of the buffer (Luke Dashjr)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
418d4ad110
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 3
      src/netbase.cpp

3
src/netbase.cpp

@ -1252,7 +1252,8 @@ std::string NetworkErrorString(int err)
#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 */
(void) strerror_r(err, buf, sizeof(buf)); if (strerror_r(err, buf, sizeof(buf)))
buf[0] = 0;
#endif #endif
return strprintf("%s (%d)", s, err); return strprintf("%s (%d)", s, err);
} }

Loading…
Cancel
Save