unlink(), etc. */
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
-#define _CRT_SECURE_NO_WARNINGS /* for __sys_errlist, __sys_nerr, _open(),
- _wfopen(), _wopen(), fopen(), freopen(),
- getenv(), gmtime(), sprintf(), strcpy(),
+#define _CRT_SECURE_NO_WARNINGS /* for _open(), _wfopen(), _wopen(), fopen(),
+ freopen(), getenv(), gmtime(), sprintf(),
+ strcpy(),
in tests: localtime(), open(), sscanf() */
#endif
#endif /* _MSC_VER */
*buf = '\0';
#ifdef _WIN32
- /* 'sys_nerr' is the maximum errno number, it is not widely portable */
- if(err >= 0 && err < sys_nerr)
- SNPRINTF(buf, buflen, "%s", sys_errlist[err]);
- else {
- if(
+ if((!strerror_s(buf, buflen, err) || !strcmp(buf, "Unknown error")) &&
#ifdef USE_WINSOCK
- !get_winsock_error(err, buf, buflen) &&
+ !get_winsock_error(err, buf, buflen) &&
#endif
- !curlx_get_winapi_error((DWORD)err, buf, buflen))
- SNPRINTF(buf, buflen, "Unknown error %d (%#x)", err, err);
- }
+ !curlx_get_winapi_error((DWORD)err, buf, buflen))
+ SNPRINTF(buf, buflen, "Unknown error %d (%#x)", err, err);
#else /* !_WIN32 */
#if defined(HAVE_STRERROR_R) && defined(HAVE_POSIX_STRERROR_R)