X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Futils.c;h=6e1c4ccb27bc98d017bb6d751791b9ce5514fe74;hp=92505b4a6f8a17a60f8f60a9dbb88c18214075a8;hb=963c5055505f2fc117cd5efa06eaa02c9b2bf85d;hpb=e99687f6b8c784e9a1805d1435e91a08b4ea6408 diff --git a/src/utils.c b/src/utils.c index 92505b4a..6e1c4ccb 100644 --- a/src/utils.c +++ b/src/utils.c @@ -182,15 +182,12 @@ const char *winerror(int err) { ptr = buf + sprintf(buf, "(%d) ", err); - if(!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), ptr, sizeof(buf) - (ptr - buf), NULL)) { + if(!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), ptr, sizeof(buf) - (ptr - buf), NULL)) { strncpy(buf, "(unable to format errormessage)", sizeof(buf)); } - ; - if((ptr = strchr(buf, '\r'))) { - * ptr = '\0'; + *ptr = '\0'; } return buf;