Fix HAVE_DECL_RES_INIT conditionals.
authorEtienne Dechamps <etienne@edechamps.fr>
Sat, 14 Mar 2015 16:17:32 +0000 (16:17 +0000)
committerEtienne Dechamps <etienne@edechamps.fr>
Sat, 14 Mar 2015 16:22:26 +0000 (16:22 +0000)
HAVE_DECL_RES_INIT is generated using AC_CHECK_DECLS. tinc checks this
symbol using #ifdef, which is wrong because (according to autoconf docs)
the symbol is always defined, it's just set to zero if the check failed.

This broke the Windows build starting from
0b310bf406dbe58afe37fa31156b9ea47599d7be, because it introduced this
conditional in code that's not excluded from the Windows build.

src/net_setup.c
src/netutl.c

index d1d5c04be36ff5bfbbe002b106551a789a1635f2..3ed6fbb0deb12dfa1d01e583428c668522274d39 100644 (file)
@@ -664,7 +664,7 @@ static bool add_listen_address(char *address, bool bindto) {
        hint.ai_protocol = IPPROTO_TCP;
        hint.ai_flags = AI_PASSIVE;
 
-#ifdef HAVE_DECL_RES_INIT
+#if HAVE_DECL_RES_INIT
        res_init();
 #endif
        int err = getaddrinfo(address && *address ? address : NULL, port, &hint, &ai);
index 3ea5d4a279085adb346ceafcd8c60f2be69b4b35..bff734e13c79a942d8649642d0c25dd43c2a8f0e 100644 (file)
@@ -39,7 +39,7 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock
        hint.ai_family = addressfamily;
        hint.ai_socktype = socktype;
 
-#ifdef HAVE_DECL_RES_INIT
+#if HAVE_DECL_RES_INIT
        res_init();
 #endif
        err = getaddrinfo(address, service, &hint, &ai);