summary refs log tree commit diff
path: root/resolv/res_send.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-24 09:20:14 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-24 09:20:14 +0000
commit8aeb5058b6457cf9ca8d76026cbb60ca07015570 (patch)
treed4e7fb5f8e330a1c42b694f59c9b513341bb7a27 /resolv/res_send.c
parent8cf26632527ab97265a4925dfd7d89ca48b4c28b (diff)
downloadglibc-8aeb5058b6457cf9ca8d76026cbb60ca07015570.tar.gz
glibc-8aeb5058b6457cf9ca8d76026cbb60ca07015570.tar.xz
glibc-8aeb5058b6457cf9ca8d76026cbb60ca07015570.zip
Update.
	* resolv/res_send.c (send_dg): Cope with failures.
Diffstat (limited to 'resolv/res_send.c')
-rw-r--r--resolv/res_send.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 18e54dbcda..8fb21a9446 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -906,7 +906,7 @@ send_dg(res_state statp,
 				goto wait;
 			}
 		}
-		Perror(statp, stderr, "select", errno);
+		Perror(statp, stderr, "poll", errno);
 		res_nclose(statp);
 		return (0);
 	}
@@ -922,9 +922,7 @@ send_dg(res_state statp,
 		pfd[0].events = POLLIN;
 		++nwritten;
 		goto wait;
-	} else {
-		assert(pfd[0].revents & POLLIN);
-
+	} else if (pfd[0].revents & POLLIN) {
 		fromlen = sizeof(struct sockaddr_in6);
 		if (anssiz < MAXPACKET
 		    && anscp
@@ -1030,6 +1028,10 @@ send_dg(res_state statp,
 		 * next nameserver ought not be tried.
 		 */
 		return (resplen);
+	} else if (pfd[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
+		/* Something went wrong.  We can stop trying.  */
+		res_nclose(statp);
+		return (0);
 	}
 }