aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/strerror.c6
-rw-r--r--tests/server/util.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/strerror.c b/lib/strerror.c
index d0650d80c..7aaa9f4a7 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -670,7 +670,8 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
wchar_t wbuf[256];
wbuf[0] = L'\0';
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
+ FormatMessage((FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
LANG_NEUTRAL, wbuf, sizeof(wbuf)/sizeof(wchar_t), NULL);
wcstombs(buf, wbuf, max);
}
@@ -680,7 +681,8 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
strncpy(buf, strerror(err), max);
else {
if(!get_winsock_error(err, buf, max) &&
- !FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
+ !FormatMessageA((FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
LANG_NEUTRAL, buf, (DWORD)max, NULL))
msnprintf(buf, max, "Unknown error %d (%#x)", err, err);
}
diff --git a/tests/server/util.c b/tests/server/util.c
index cc53d3bf4..263f0cece 100644
--- a/tests/server/util.c
+++ b/tests/server/util.c
@@ -150,7 +150,8 @@ void win32_perror(const char *msg)
char buf[512];
DWORD err = SOCKERRNO;
- if(!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
+ if(!FormatMessageA((FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
LANG_NEUTRAL, buf, sizeof(buf), NULL))
msnprintf(buf, sizeof(buf), "Unknown error %lu (%#lx)", err, err);
if(msg)