X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Fxmalloc.c;h=58f2bcee3e950e0958d240afe8501de876d64e6d;hp=e4079ce4cafe93c0296e4a05bce43d1cb9851be0;hb=cfa738d3185980ff8532a35192a9113b0e9a937c;hpb=48e513a5a972c18431c593f06ddcee9be4369c77 diff --git a/lib/xmalloc.c b/lib/xmalloc.c index e4079ce4..58f2bcee 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -147,10 +147,18 @@ int xasprintf(char **strp, const char *fmt, ...) { } 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) + exit(xalloc_exit_failure); + *strp = xstrdup(buf); +#else int result = vasprintf(strp, fmt, ap); if(result < 0) { fprintf(stderr, "vasprintf() failed: %s\n", strerror(errno)); exit(xalloc_exit_failure); } +#endif return result; }