We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 46971c6 commit e7f2f77Copy full SHA for e7f2f77
src/util/syserror.cpp
@@ -15,15 +15,21 @@ std::string SysErrorString(int err)
15
{
16
char buf[256];
17
buf[0] = 0;
18
- /* Too bad there are two incompatible implementations of the
+ /* Too bad there are three incompatible implementations of the
19
* thread-safe strerror. */
20
const char *s;
21
+#ifdef WIN32
22
+ s = buf;
23
+ if (strerror_s(buf, sizeof(buf), err) != 0)
24
+ buf[0] = 0;
25
+#else
26
#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
27
s = strerror_r(err, buf, sizeof(buf));
28
#else /* POSIX variant always returns message in buffer */
29
s = buf;
30
if (strerror_r(err, buf, sizeof(buf)))
31
32
+#endif
33
#endif
34
return strprintf("%s (%d)", s, err);
35
}
0 commit comments