]> git.meshlink.io Git - catta/commitdiff
Merge branch 'develop' of github.com:catta-x/catta into develop
authorHiveError <hiveerror@gmail.com>
Mon, 31 Aug 2015 15:36:35 +0000 (17:36 +0200)
committerHiveError <hiveerror@gmail.com>
Mon, 31 Aug 2015 15:36:35 +0000 (17:36 +0200)
src/compat/windows/wincompat.c
src/socket.c

index 93a557e1e897a35c5663af87f0d988cae62abc1a..63f3e7de1469a6cc71a348c796aee6b7655763be 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <stdint.h>
+#include <stdio.h>
 
 #include <catta/log.h>
 
@@ -50,8 +51,10 @@ char *errnostrsocket(void)
 {
     static char buf[256];
 
+    int err = WSAGetLastError();
+    int len = snprintf(buf, sizeof(buf), "[%i] ", err);
     FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-                  NULL, WSAGetLastError(), 0, buf, sizeof(buf), NULL);
+                  NULL, err, 0, buf + len, sizeof(buf) - len, NULL);
 
     return buf;
 }
index 4f60139b7f1fab50f763d95e818087dde10f0458..31adcf81a99e5080ccd7ea7af3e80be8c0bee1f4 100644 (file)
@@ -617,6 +617,11 @@ int catta_send_dns_packet_ipv6(
     msg.msg_iovlen = 1;
     msg.msg_flags = 0;
 
+// TODO: don't ask me why, but Win8.1 64bit WSASendMsg() fails with an InvalidArgument error 10022 when IPv6 source address is specified ( everHannes / hannes.ahrens@everbase.net )
+#ifdef _WIN32
+    msg.msg_control = NULL;
+    msg.msg_controllen = 0;
+#else    
     if (iface > 0 || src_address) {
         struct in6_pktinfo *pkti;
 
@@ -640,6 +645,7 @@ int catta_send_dns_packet_ipv6(
         msg.msg_control = NULL;
         msg.msg_controllen = 0;
     }
+#endif
 
     return sendmsg_loop(fd, &msg, 0);
 }