$NetBSD$

--- libmilter/sm_gethost.c.orig	2020-05-19 21:54:32.000000000 +0200
+++ libmilter/sm_gethost.c	2021-03-18 16:07:39.066216179 +0100
@@ -27,8 +27,12 @@
 **
 **	Support IPv6 as well as IPv4.
 */
 
+#if !HAS_GETHOSTBYNAME2
+extern struct __res_state sm_res;
+#endif
+
 #if NETINET6 && NEEDSGETIPNODE
 
 static struct hostent *sm_getipnodebyname __P((const char *, int, int, int *));
 
@@ -63,17 +67,17 @@
 
 	if (family == AF_INET6)
 	{
 		/* From RFC2133, section 6.1 */
-		resv6 = bitset(RES_USE_INET6, _res.options);
-		_res.options |= RES_USE_INET6;
+		resv6 = bitset(RES_USE_INET6, sm_res.options);
+		sm_res.options |= RES_USE_INET6;
 	}
 #  endif /* RES_USE_INET6 */
 	SM_SET_H_ERRNO(0);
 	h = gethostbyname(name);
 #  ifdef RES_USE_INET6
 	if (!resv6)
-		_res.options &= ~RES_USE_INET6;
+		sm_res.options &= ~RES_USE_INET6;
 #  endif
 
 	/* the function is supposed to return only the requested family */
 	if (h != NULL && h->h_addrtype != family)
