sergio/takana
> Una distribución Linux construida con un laboratorio funcional y hermético en el > sótano, y una terminal mutable, clásica y anárquica en el piso de arriba — diseñada > desde el suelo para que una IA programadora entienda, modifique y co…
kde/H-Qt: receta qtbase de-Alpinizada (gate campaña KDE) + cola incoming-kde al worker
1diff --git a/cmake/FindWrapResolv.cmake b/cmake/FindWrapResolv.cmake
2index 159df9b60d8..7d6b3fa50f7 100644
3--- a/cmake/FindWrapResolv.cmake
4+++ b/cmake/FindWrapResolv.cmake
5@@ -40,9 +40,8 @@ check_cxx_source_compiles("
6
7 int main(int, char **argv)
8 {
9- res_state statep = {};
10- int n = res_nmkquery(statep, 0, argv[1], 0, 0, NULL, 0, NULL, NULL, 0);
11- n = res_nsend(statep, NULL, 0, NULL, 0);
12+ int n = res_mkquery(0, argv[1], 0, 0, NULL, 0, NULL, NULL, 0);
13+ n = res_send(NULL, 0, NULL, 0);
14 n = dn_expand(NULL, NULL, NULL, NULL, 0);
15 return n;
16 }
17diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
18index 4262ad58d50..47524f954af 100644
19--- a/src/network/kernel/qdnslookup_unix.cpp
20+++ b/src/network/kernel/qdnslookup_unix.cpp
21@@ -25,6 +25,10 @@ QT_REQUIRE_CONFIG(libresolv);
22
23 #include <array>
24
25+#if !defined(__GLIBC__)
26+# include "resolv_compat.h"
27+#endif
28+
29 #ifndef T_OPT
30 // the older arpa/nameser_compat.h wasn't updated between 1999 and 2016 in glibc
31 # define T_OPT ns_t_opt
32@@ -133,7 +137,7 @@ static int
33 prepareQueryBuffer(res_state state, QueryBuffer &buffer, const char *label, ns_rcode type)
34 {
35 // Create header and our query
36- int queryLength = res_nmkquery(state, QUERY, label, C_IN, type, nullptr, 0, nullptr,
37+ int queryLength = res_mkquery(QUERY, label, C_IN, type, nullptr, 0, nullptr,
38 buffer.data(), buffer.size());
39 Q_ASSERT(queryLength < int(buffer.size()));
40 if (Q_UNLIKELY(queryLength < 0))
41@@ -170,7 +174,7 @@ static int sendStandardDns(QDnsLookupReply *reply, res_state state, QSpan<unsign
42
43 auto attemptToSend = [&]() {
44 std::memset(buffer.data(), 0, HFIXEDSZ); // the header is enough
45- int responseLength = res_nsend(state, qbuffer.data(), qbuffer.size(), buffer.data(), buffer.size());
46+ int responseLength = res_send(qbuffer.data(), qbuffer.size(), buffer.data(), buffer.size());
47 if (responseLength >= 0)
48 return responseLength; // success
49
50diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
51index 3b0e2d333aa..8eeb3cc2c0d 100644
52--- a/src/network/kernel/qhostinfo_unix.cpp
53+++ b/src/network/kernel/qhostinfo_unix.cpp
54@@ -18,6 +18,10 @@
55 # include <resolv.h>
56 #endif
57
58+#if !defined(__GLIBC__)
59+# include "resolv_compat.h"
60+#endif
61+
62 #ifndef _PATH_RESCONF
63 # define _PATH_RESCONF "/etc/resolv.conf"
64 #endif
65diff --git a/src/network/kernel/resolv_compat.h b/src/network/kernel/resolv_compat.h
66new file mode 100644
67index 0000000..4f0e852
68--- /dev/null
69+++ b/src/network/kernel/resolv_compat.h
70@@ -0,0 +1,29 @@
71+#if !defined(__GLIBC__)
72+/***************************************************************************
73+ * resolv_compat.h
74+ *
75+ * Mimick GLIBC's res_ninit() and res_nclose() for musl libc
76+ * Note: res_init() is actually deprecated according to
77+ * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html
78+ **************************************************************************/
79+#include <string.h>
80+
81+static inline int res_ninit(res_state statp)
82+{
83+ int rc = res_init();
84+ if (statp != &_res) {
85+ memcpy(statp, &_res, sizeof(*statp));
86+ }
87+ return rc;
88+}
89+
90+static inline int res_nclose(res_state statp)
91+{
92+ if (!statp)
93+ return -1;
94+ if (statp != &_res) {
95+ memset(statp, 0, sizeof(*statp));
96+ }
97+ return 0;
98+}
99+#endif