const char *xstrerror(int errnum, char *buf, size_t len) {
#ifdef HAVE_STRERROR_R
# ifdef __USE_GNU
    /* Annoying linux specific API contract */
    return strerror_r(errnum, buf, len);
# else
    strerror_r(errnum, buf, len);
    return buf;
# endif
#else
    int n = snprintf(buf, len, "errno=%d", errnum);
    return (0 < n && n < len
            ? buf : "internal error: buffer too small in xstrerror");
#endif
}
const char *xstrerror(int errnum, char *buf, size_t len) {
#ifdef HAVE_STRERROR_R
# ifdef __USE_GNU
     
    return strerror_r(errnum, buf, len);
# else
    strerror_r(errnum, buf, len);
    return buf;
# endif
#else
    int n = snprintf(buf, len, "errno=%d", errnum);
    return (0 < n && n < len
            ? buf : "internal error: buffer too small in xstrerror");
#endif
}