X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fxalloc.h;h=28960fbd4e06efccb19ba01a5dfc49c32da353fd;hb=cda5a477c8138226d184a176256d559971b4f7ed;hp=6629b60b9ce869d81a773531be6e1473e77edf81;hpb=ad93dc3a4b89799e8d5c1154e1dacc5b9a31c83b;p=tinc diff --git a/src/xalloc.h b/src/xalloc.h index 6629b60b..28960fbd 100644 --- a/src/xalloc.h +++ b/src/xalloc.h @@ -52,9 +52,17 @@ static inline char *xstrdup(const char *s) { } static inline int xvasprintf(char **strp, const char *fmt, va_list ap) { +#ifdef HAVE_MINGW + char buf[1024]; + int result = vsnprintf(buf, sizeof buf, fmt, ap); + if(result < 0) + abort(); + *strp = xstrdup(buf); +#else int result = vasprintf(strp, fmt, ap); if(result < 0) abort(); +#endif return result; }