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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
diff --git a/src/libspf2/spf_dns_resolv.c b/src/libspf2/spf_dns_resolv.c
index 10ccee6..7acdd1f 100644
--- a/src/libspf2/spf_dns_resolv.c
+++ b/src/libspf2/spf_dns_resolv.c
@@ -79,13 +79,13 @@ static const struct res_sym ns_sects[] = {
static const int num_ns_sect = sizeof(ns_sects) / sizeof(*ns_sects);
-#if HAVE_DECL_RES_NINIT
+#if HAVE_DECL_RES_NINIT && !defined(__UCLIBC__)
# define SPF_h_errno res_state->res_h_errno
#else
# define SPF_h_errno h_errno
#endif
-#if HAVE_DECL_RES_NINIT
+#if HAVE_DECL_RES_NINIT && !defined(__UCLIBC__)
static pthread_once_t res_state_control = PTHREAD_ONCE_INIT;
static pthread_key_t res_state_key;
@@ -239,14 +239,14 @@ SPF_dns_resolv_lookup(SPF_dns_server_t *spf_dns_server,
size_t rdlen;
const u_char *rdata;
-#if HAVE_DECL_RES_NINIT
+#if HAVE_DECL_RES_NINIT && !defined(__UCLIBC__)
void *res_spec;
struct __res_state *res_state;
#endif
SPF_ASSERT_NOTNULL(spf_dns_server);
-#if HAVE_DECL_RES_NINIT
+#if HAVE_DECL_RES_NINIT && !defined(__UCLIBC__)
/** Get the thread-local resolver state. */
res_spec = pthread_getspecific(res_state_key);
if (res_spec == NULL) {
@@ -292,7 +292,7 @@ SPF_dns_resolv_lookup(SPF_dns_server_t *spf_dns_server,
for (;;) {
int dns_len;
-#if HAVE_DECL_RES_NINIT
+#if HAVE_DECL_RES_NINIT && !defined(__UCLIBC__)
/* Resolve the name. */
dns_len = res_nquery(res_state, domain, ns_c_in, rr_type,
responsebuf, responselen);
@@ -606,7 +606,7 @@ SPF_dns_resolv_free(SPF_dns_server_t *spf_dns_server)
{
SPF_ASSERT_NOTNULL(spf_dns_server);
-#if ! HAVE_DECL_RES_NINIT
+#if ! HAVE_DECL_RES_NINIT || defined(__UCLIBC__)
res_close();
#endif
@@ -619,7 +619,7 @@ SPF_dns_resolv_new(SPF_dns_server_t *layer_below,
{
SPF_dns_server_t *spf_dns_server;
-#if HAVE_DECL_RES_NINIT
+#if HAVE_DECL_RES_NINIT && !defined(__UCLIBC__)
pthread_once(&res_state_control, SPF_dns_resolv_init_key);
#else
if (res_init() != 0) {
|