]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd_win32wrapper.cpp
Fix problem where in certain cases a \0 would be sent out. Thx to network Hak5IRC...
[user/henk/code/inspircd.git] / win / inspircd_win32wrapper.cpp
index 1291bbd0a6a329eefa92dc939e865644090c413e..d2dcd7456fb6aa3d7901c81ea94a38a05fb1519c 100644 (file)
@@ -65,6 +65,13 @@ int inet_pton(int af, const char *src, void *dst)
        sockaddr_in sa;\r
        int len = sizeof(SOCKADDR);\r
        int rv = WSAStringToAddress((LPSTR)src, af, NULL, (LPSOCKADDR)&sa, &len);\r
+       if(rv >= 0)\r
+       {\r
+               if(WSAGetLastError() == 10022)                  // Invalid Argument\r
+                       rv = 0;\r
+               else\r
+                       rv = 1;\r
+       }\r
        memcpy(dst, &sa.sin_addr, sizeof(struct in_addr));\r
        return rv;\r
 }\r
@@ -455,7 +462,6 @@ void ClearConsole()
 {\r
        COORD coordScreen = { 0, 0 };    /* here's where we'll home the cursor */\r
        HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);\r
-       BOOL bSuccess;\r
        DWORD cCharsWritten;\r
        CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */ \r
        DWORD dwConSize;                 /* number of character cells in the current buffer */ \r