Skip to content

Commit

Permalink
Merge pull request bitcoin#4479
Browse files Browse the repository at this point in the history
109849e Bugfix: strerror_r can return an error, and if it does, POSIX does not specify the content of the buffer (Luke Dashjr)
  • Loading branch information
laanwj committed Jul 8, 2014
2 parents 7d05645 + 109849e commit 418d4ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,8 @@ std::string NetworkErrorString(int err)
#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 */
(void) strerror_r(err, buf, sizeof(buf));
if (strerror_r(err, buf, sizeof(buf)))
buf[0] = 0;
#endif
return strprintf("%s (%d)", s, err);
}
Expand Down

0 comments on commit 418d4ad

Please sign in to comment.