(lib/roken) Use strerror_s() to emulate strerror_r() on Windows

This commit is contained in:
Asanka Herath
2009-11-26 01:56:50 -05:00
parent f065ca176f
commit eb3dc6fabd

View File

@@ -37,6 +37,22 @@
#include <string.h>
#include <errno.h>
#ifdef _MSC_VER
char * ROKEN_LIB_FUNCTION
strerror_r(int eno, char * strerrbuf, size_t buflen)
{
errno_t err;
err = strerror_s(strerrbuf, buflen, eno);
if (err != 0)
sprintf_s(strerrbuf, buflen, "Error % occurred.", eno);
return strerrbuf;
}
#else
extern int sys_nerr;
extern char *sys_errlist[];
@@ -53,3 +69,5 @@ strerror_r(int eno, char *strerrbuf, size_t buflen)
return ERANGE;
return 0;
}
#endif