MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SysErrorString

Function SysErrorString

src/util/syserror.cpp:18–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#endif
17
18std::string SysErrorString(int err)
19{
20 char buf[1024];
21 /* Too bad there are three incompatible implementations of the
22 * thread-safe strerror. */
23 const char *s = nullptr;
24#ifdef WIN32
25 if (strerror_s(buf, sizeof(buf), err) == 0) s = buf;
26#else
27#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
28 s = strerror_r(err, buf, sizeof(buf));
29#else /* POSIX variant always returns message in buffer */
30 if (strerror_r(err, buf, sizeof(buf)) == 0) s = buf;
31#endif
32#endif
33 if (s != nullptr) {
34 return strprintf("%s (%d)", s, err);
35 } else {
36 return strprintf("Unknown error (%d)", err);
37 }
38}
39
40#if defined(WIN32)
41std::string Win32ErrorString(int err)

Callers 15

SerializeFileDBFunction · 0.85
CreatePidFileFunction · 0.85
AppInitFunction · 0.85
~AutoFileMethod · 0.85
FlushFeeEstimatesMethod · 0.85
CustomCommitMethod · 0.85
WriteFilterToDiskMethod · 0.85
WriteUTXOSnapshotFunction · 0.85
connectMethod · 0.85
bindMethod · 0.85
FileCommitFunction · 0.85
GetErrorReasonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected