glib/strfuncs.c: Fix Build on Windows

Windows does not have strerror_r(), but does have strerror_s(), which is
threadsafe, and does more or less the same thing, so use it on Windows to
fix the build.

https://bugzilla.gnome.org/show_bug.cgi?id=754431
This commit is contained in:
Chun-wei Fan 2015-09-02 16:09:58 +08:00
parent 4a09d0cf7a
commit 4cad3f5e1b

View File

@ -1261,7 +1261,12 @@ g_strerror (gint errnum)
/* Since we are building with _GNU_SOURCE, we get the
* GNU variant of strerror_r (with glibc).
*/
#ifdef G_OS_WIN32
strerror_s (buf, sizeof (buf), errnum);
msg = buf;
#else
msg = strerror_r (errnum, buf, sizeof (buf));
#endif
if (!g_get_charset (NULL))
{
msg = tofree = g_locale_to_utf8 (msg, -1, NULL, NULL, &error);