]> 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 2be5a8bcdf59382bf99ccbdaa8e1c556158c806d..d2dcd7456fb6aa3d7901c81ea94a38a05fb1519c 100644 (file)
@@ -1,3 +1,16 @@
+/*       +------------------------------------+\r
+ *       | Inspire Internet Relay Chat Daemon |\r
+ *       +------------------------------------+\r
+ *\r
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team\r
+ * See: http://www.inspircd.org/wiki/index.php/Credits\r
+ *\r
+ * This program is free but copyrighted software; see\r
+ *            the file COPYING for details.\r
+ *\r
+ * ---------------------------------------------------\r
+ */\r
+\r
 #include "inspircd_win32wrapper.h"\r
 #include "inspircd.h"\r
 #include <string>\r
@@ -52,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
@@ -442,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
@@ -468,4 +487,4 @@ void ClearConsole()
                }\r
        }\r
        return;\r
-}
\ No newline at end of file
+}\r