mdbx: refine Coverity warning fix.

Change-Id: I6bbb791f32a6b64712e88e0b2dd87052e353c730
This commit is contained in:
Leo Yuriev 2018-06-21 18:28:30 +03:00
parent 31b5f64054
commit bc77ab3cca

View File

@ -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 *msg = __mdbx_strerr(errnum);
if (!msg) {
static char buffer[1024];
#ifdef _MSC_VER
static char buffer[1024];
size_t size = FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
errnum, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer,
@ -1143,6 +1143,7 @@ const char *__cold mdbx_strerror(int errnum) {
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;