Install tinc as a service under Windows (MinGW). Remove cleanup_and_exit(),
[oweals/tinc.git] / lib / utils.c
index 9ffad70289c11945fbf82662af2e3970f07d86cf..6b3dd237ed32616be75310581ef74790749487ac 100644 (file)
@@ -79,3 +79,17 @@ void cp_trace()
                );
 }
 #endif
+
+#ifdef HAVE_MINGW
+char *winerror(int err) {
+       static char buf[1024];
+
+       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));
+       };
+
+       return buf;
+}
+#endif
+