diff -upr p11-kit-98292d6bbc.old/common/compat.c p11-kit-98292d6bbc/common/compat.c --- p11-kit-98292d6bbc.old/common/compat.c 2014-03-26 05:06:34 +0000 +++ p11-kit-98292d6bbc/common/compat.c 2014-03-26 05:04:47 +0000 @@ -840,7 +840,17 @@ strerror_r (int errnum, size_t buflen) { #ifdef OS_WIN32 + #ifdef __MINGW32__ + char *str = strerror (errnum); + if (!str) { + *buf = 0; + return EINVAL; + } + strncpy (buf, str, buflen); + return 0; + #else return strerror_s (buf, buflen, errnum); + #endif #else #error no strerror_r implementation #endif