about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/network/res_msend.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/network/res_msend.c b/src/network/res_msend.c
index 105bf598..9adaea13 100644
--- a/src/network/res_msend.c
+++ b/src/network/res_msend.c
@@ -72,6 +72,11 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
 
 	/* Handle case where system lacks IPv6 support */
 	if (fd < 0 && family == AF_INET6 && errno == EAFNOSUPPORT) {
+		for (i=0; i<nns && conf->ns[nns].family == AF_INET6; i++);
+		if (i==nns) {
+			pthread_setcancelstate(cs, 0);
+			return -1;
+		}
 		fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
 		family = AF_INET;
 		sl = sizeof sa.sin;