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