Don't try to call res_init() if ./configure told us it doesn't exist.
[tinc] / src / net_setup.c
index 765a9eb..863616b 100644 (file)
@@ -1,7 +1,7 @@
 /*
     net_setup.c -- Setup.
     Copyright (C) 1998-2005 Ivo Timmermans,
-                  2000-2014 Guus Sliepen <guus@tinc-vpn.org>
+                  2000-2015 Guus Sliepen <guus@tinc-vpn.org>
                   2006      Scott Lamb <slamb@slamb.org>
                   2010      Brandon Black <blblack@gmail.com>
 
@@ -813,6 +813,10 @@ static bool setup_myself(void) {
                        hint.ai_protocol = IPPROTO_TCP;
                        hint.ai_flags = AI_PASSIVE;
 
+#if HAVE_DECL_RES_INIT
+                       // ensure glibc reloads /etc/resolv.conf.
+                       res_init();
+#endif
                        err = getaddrinfo(address && *address ? address : NULL, port, &hint, &ai);
                        free(address);