blob: df618e1fbc2fe8bdb4d7231b9aa7f3adaae56c6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
--- a/src/network/kernel/qhostinfo_unix.cpp 2008-04-28 16:11:19.000000000 +0300
+++ b/src/network/kernel/qhostinfo_unix.cpp 2008-06-08 02:35:23.000000000 +0300
@@ -167,8 +167,19 @@
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
+# ifdef AI_ADDRCONFIG
+ hints.ai_flags = AI_ADDRCONFIG;
+# endif
int result = getaddrinfo(hostName.toLatin1().constData(), 0, &hints, &res);
+# ifdef AI_ADDRCONFIG
+ if (result == EAI_BADFLAGS) {
+ // if the lookup failed with AI_ADDRCONFIG set, try again without it
+ hints.ai_flags = 0;
+ result = getaddrinfo(hostName.toLatin1().constData(), 0, &hints, &res);
+ }
+# endif
+
if (result == 0) {
addrinfo *node = res;
QList<QHostAddress> addresses;
@@ -200,7 +211,6 @@
freeaddrinfo(res);
} else if (result == EAI_NONAME
|| result == EAI_FAIL
- || result == EAI_FAIL
#ifdef EAI_NODATA
// EAI_NODATA is deprecated in RFC 3493
|| result == EAI_NODATA
|