File resolv-dont-ignore-second-answer.patch of Package glibc.8004

Don't ignore second answer from nameserver if the first one was empty (BZ #13651)

Index: glibc-2.19/resolv/res_query.c
===================================================================
--- glibc-2.19.orig/resolv/res_query.c
+++ glibc-2.19/resolv/res_query.c
@@ -382,7 +382,7 @@ __libc_res_nsearch(res_state statp,
 					      answer, anslen, answerp,
 					      answerp2, nanswerp2, resplen2,
 					      answerp2_malloced);
-		if (ret > 0 || trailing_dot)
+		if (ret > 0 || (ret == 0 && *resplen2 > 0) || trailing_dot)
 			return (ret);
 		saved_herrno = h_errno;
 		tried_as_is++;
@@ -422,7 +422,7 @@ __libc_res_nsearch(res_state statp,
 						      answer, anslen, answerp,
 						      answerp2, nanswerp2,
 						      resplen2, answerp2_malloced);
-			if (ret > 0)
+			if (ret > 0 || (ret == 0 && *resplen2 > 0))
 				return (ret);
 
 			if (answerp && *answerp != answer) {
@@ -491,7 +491,7 @@ __libc_res_nsearch(res_state statp,
 					      answer, anslen, answerp,
 					      answerp2, nanswerp2, resplen2,
 					      answerp2_malloced);
-		if (ret > 0)
+		if (ret > 0 || (ret == 0 && *resplen2 > 0))
 			return (ret);
 	}
openSUSE Build Service is sponsored by