summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Chu <hyc@openldap.org>2016-02-15 00:07:04 +0000
committerHoward Chu <hyc@openldap.org>2016-02-15 00:07:04 +0000
commitd909ab2f36e079087047dd842210b37cec8b6a84 (patch)
tree1de28010e9e6e8ac32a3cc21090f1d9fbcf9c984
parent5ef1908224121c01eb9190b03978d563cc0c22d2 (diff)
downloadlmdb-d909ab2f36e079087047dd842210b37cec8b6a84.tar.gz
lmdb-d909ab2f36e079087047dd842210b37cec8b6a84.tar.bz2
lmdb-d909ab2f36e079087047dd842210b37cec8b6a84.zip
Tweak Win32 errmsg buffer
-rw-r--r--libraries/liblmdb/mdb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c
index cddc746..f598080 100644
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -1572,8 +1572,9 @@ mdb_strerror(int err)
* This works as long as no function between the call to mdb_strerror
* and the actual use of the message uses more than 4K of stack.
*/
- char pad[4096];
- char buf[1024], *ptr = buf;
+#define MSGSIZE 1024
+#define PADSIZE 4096
+ char buf[MSGSIZE+PADSIZE], *ptr = buf;
#endif
int i;
if (!err)
@@ -1605,7 +1606,7 @@ mdb_strerror(int err)
buf[0] = 0;
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, 0, ptr, sizeof(buf), (va_list *)pad);
+ NULL, err, 0, ptr, MSGSIZE, (va_list *)buf+MSGSIZE);
return ptr;
#else
return strerror(err);