X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Futils.c;h=2e40ef5889f8c6890ed3eaed5b45483ebc8c4ba3;hp=43abf96ee356034d74462bc9fc3d1ce87c284b1f;hb=b0825f36b7b5dade1693fdbddfec7eef3f5ed86f;hpb=6f3099595530280028f6ec3d0b310df523e75f98 diff --git a/lib/utils.c b/lib/utils.c index 43abf96e..2e40ef58 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -86,13 +86,16 @@ void cp_trace() #endif char *winerror(int err) { - static char buf[1024]; + static char buf[1024], *newline; if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, sizeof(buf), NULL)) { strncpy(buf, _("(unable to format errormessage)"), sizeof(buf)); }; + if((newline = strchr(buf, '\r'))) + *newline = '\0'; + return buf; } #endif