mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-10 03:14:13 +08:00
mdbx: backport - fix Coverity warning (minor, paranoia).
Change-Id: I232377a03244dc33beb4f332c0024b454027f659
This commit is contained in:
parent
408848a425
commit
db50fb8726
@ -1134,7 +1134,7 @@ const char *__cold mdbx_strerror(int errnum) {
|
||||
const char *msg = __mdbx_strerr(errnum);
|
||||
if (!msg) {
|
||||
#ifdef _MSC_VER
|
||||
static __thread char buffer[1024];
|
||||
static char buffer[1024];
|
||||
size_t size = FormatMessageA(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
|
||||
errnum, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer,
|
||||
@ -1142,6 +1142,13 @@ const char *__cold mdbx_strerror(int errnum) {
|
||||
if (size)
|
||||
msg = buffer;
|
||||
#else
|
||||
if (errnum < 0) {
|
||||
static char buffer[32];
|
||||
int rc = snprintf(buffer, sizeof(buffer) - 1, "unknown error %d", errnum);
|
||||
assert(rc > 0);
|
||||
(void)rc;
|
||||
return buffer;
|
||||
}
|
||||
msg = strerror(errnum);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user